Hi I am working on a project,where I am generating sql query for CRUD operations performed on a table having xml data in one of its column.I have successfully generated sql queries and for now I am displaying those query in a textarea and saving those query in a .txt file but now I want that those query could be saved to a .sql file. For now I am storing my query in a text file with the below code.
Query for update
sqlQuery = "update tblCCBT_Step_Page_Text_Xml set Xml_XmlData.modify('replace value of (/page/*[position()="+xmlNodeIndex+"]/text())[1] with " + newValue + " ') where Xml_Id = " + xmlId;
string a = Server.MapPath("~/Content/dbScripts");
string dt = System.DateTime.Now.ToShortTimeString();
dt = dt.Replace(":", "-");
FileStream fs1 = new FileStream(a + "\\editNode_"+dt+".txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter writer = new StreamWriter(fs1);
writer.Write(sqlQuery);
writer.Close();
I want my query to be saved in .sql file.Please suggest how to proceed further.Thanks