Sunday, 15 September 2013

Updating Sql from Data in the List C# Console -


I am running a query and putting that data in the list, now I want to run an update query on SQL Want data in the list

  console. WrightLine ("The SQL connection is fine"); Connection.Open (); Console.WriteLine ("opened"); String SQL = "Choose GUID, where to send GUSMStID from SMS_Table & lt; GETDATE () and status = 'active' and SMSType = 'MMS'"; (Var command = New SQL Commands (SQL, Connection)) using (var reader = command.ExecuteReader ()) {when (reader.Read ()) {var SMSlist = new SMSList (); SMSlist.GUID = Reader ["GUID"]. ToString (); SMSlist.GUSMSID = Reader ["GUSMSID"]. ToString (); Console.light line ("receiving sms ...", console caller.blue); ListofSMS.Add (SMSlist); } Console.WriteLine ("Receiving Full SMS", Console Color.Cyan);  

So I set the GUID to the list. Now I want to update SMS_table using those GUIDs, how to do it

You can use SqlCommand for inserts / updates using the ExecuteNonQuery () method.

  SQL command command = new SQL command (); (Int i = 0; i  

Above is a really simple SQL update statement that you can run on your table. You can manually write your insert / update statement in SQL and execute them in the above manner. There may be a syntax error in my SQL, but the above version should give you a general idea of ​​what you have to do.


No comments:

Post a Comment