mercredi 4 mars 2015

SQL query in XML contains parameters to be processed by C#


Vote count:

0




I am very new to C# and databases and XML!


Actual Query to run: Select * from table where Param1 = SomeValue and where param2 = SomeValue This query has to run multiple times with different 'SomeValue' so my C# code looks like this in a foreach loop: string SQL query = Select * from table where Param1 ="+ SomeValue +" and where param2 ="+ SomeValue;


There are two problems now:


1) I have to read the query from an XML so I have put this in the XML <>Select * from table where Param1 ="+ ![CDATA[SomeValue]]+" and where param2 ="+ ![CDATA[SomeValue]]


Is this correct?


2) I have a re-usable method which is declared as:


public string Read_XMLNode_Value ()


so after reading this XML Node I am returning the value as a string so even the somvalue appears to be being read as a string hence it is not getting substituted with a value.


I am trying to understand generic methods as well but unable to figure out anything at the moment, can anyone please help in detail?



asked 2 mins ago







SQL query in XML contains parameters to be processed by C#

Aucun commentaire:

Enregistrer un commentaire