P
polachan
Guest
Hi
I am trying to store the all the sqls inside the tag of the xml file.
XmlDocument doc = new XmlDocument();
string docxml = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\" + sqlxml;
doc.Load(xml);
XmlNodeList subjectList = doc.GetElementsByTagName("Customer");
for (int cnt = 0; cnt < subjectList.Count; cnt++)
{
List<string> sql_strings = Here I want to store sqlstatement in to the variable sql_strings1
}
when it read the element first customer tag there two sqls .So the result should be
Sql_Strings[1] = SELECT * FROM CUSTOMER WHERE CODE = '123'
Sql_Strings[2] = SELECT * FROM CUSTOMER WHERE CODE = '567'
When the counter cnt =2 , the Sql_string should be
Sql_Strings[1] = SELECT * FROM CUSTOMER WHERE CODE = '1234'
XML file
<?xml version="1.0" encoding="utf-8" ?>
<STATEMENT>
<CUSTOMER ID = "CUSTOMER1">
<SQL ID="SQLS1">
SELECT * FROM CUSTOMER WHERE CODE = '123'
</SQL>
<SQL ID="SQLS2">
SELECT * FROM CUSTOMER WHERE CODE = '567'
</SQL>
<Address>test@gmail.com</Address>
<Address>test1@gmail.com</Address>
<Address></Address>
<MailSubject>Please find statement</MailSubject>
<MailBody>Please find statement</MailBody>
<FILENAME>file1</FILENAME>
</CUSTOMER>
<CUSTOMER ID = "CUSTOMER2">
<SQL ID="SQLS">
SELECT * FROM CUSTOMER WHERE CODE = '1234'
</SQL>
<Address>test@gmail.com</Address>
<Address>test1@gmail.com</Address>
<Address></Address>
<MailSubject>Please find statement</MailSubject>
<MailBody>Please find statement</MailBody>
<FILENAME>file2</FILENAME>
</CUSTOMER>
</STATEMENT>
Please help to get the sql like that way in to the string variable.
polachan
Continue reading...
I am trying to store the all the sqls inside the tag of the xml file.
XmlDocument doc = new XmlDocument();
string docxml = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\" + sqlxml;
doc.Load(xml);
XmlNodeList subjectList = doc.GetElementsByTagName("Customer");
for (int cnt = 0; cnt < subjectList.Count; cnt++)
{
List<string> sql_strings = Here I want to store sqlstatement in to the variable sql_strings1
}
when it read the element first customer tag there two sqls .So the result should be
Sql_Strings[1] = SELECT * FROM CUSTOMER WHERE CODE = '123'
Sql_Strings[2] = SELECT * FROM CUSTOMER WHERE CODE = '567'
When the counter cnt =2 , the Sql_string should be
Sql_Strings[1] = SELECT * FROM CUSTOMER WHERE CODE = '1234'
XML file
<?xml version="1.0" encoding="utf-8" ?>
<STATEMENT>
<CUSTOMER ID = "CUSTOMER1">
<SQL ID="SQLS1">
SELECT * FROM CUSTOMER WHERE CODE = '123'
</SQL>
<SQL ID="SQLS2">
SELECT * FROM CUSTOMER WHERE CODE = '567'
</SQL>
<Address>test@gmail.com</Address>
<Address>test1@gmail.com</Address>
<Address></Address>
<MailSubject>Please find statement</MailSubject>
<MailBody>Please find statement</MailBody>
<FILENAME>file1</FILENAME>
</CUSTOMER>
<CUSTOMER ID = "CUSTOMER2">
<SQL ID="SQLS">
SELECT * FROM CUSTOMER WHERE CODE = '1234'
</SQL>
<Address>test@gmail.com</Address>
<Address>test1@gmail.com</Address>
<Address></Address>
<MailSubject>Please find statement</MailSubject>
<MailBody>Please find statement</MailBody>
<FILENAME>file2</FILENAME>
</CUSTOMER>
</STATEMENT>
Please help to get the sql like that way in to the string variable.
polachan
Continue reading...