Subscribe to Subscribers

Online Members

Shafees ps
More...

Forums » .NET » .NET »

send query for update and delete


Posted Date: 11 Jan 2008      Posted By:: madhu     Member Level: Bronze    Member Rank: 0     Points: 2   Responses: 4



Hi,

I am using sql server 2005 with c# 2008.i know the code for update and delete in sql structure..I don't know the format of using this code in c#..send me the syntax of using query for update and delete in c#

Thanks




Responses

#178349    Author: Mohan      Member Level: Gold      Member Rank: 102     Date: 11/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

update tablename set field1='" + textbox1.text +"' where field2='" + textbox2.text + "'
delete from tablename where field2='" + textbox2.text + "'

Regards

Mohan Kumar.D


 
#178350    Author: Shanmugam      Member Level: Gold      Member Rank: 0     Date: 11/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

Same sql syntax only.

string sqlQuery= "Update EmpDetails set Name='" + TextBox1.Text + "' where EmpId=" + empId.ToString();
SqlCommand cmd = new SqlCommand(sqlQuery, con1);


 
#178352    Author: Danasegarane.A      Member Level: Gold      Member Rank: 55     Date: 11/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

Here is one example

Thanks & Regards,
Danasegarane Arunachalam

http://www.techreceipe.com/





 
#178415    Author: Shashikant Kothavale      Member Level: Silver      Member Rank: 0     Date: 11/Jan/2008   Rating: 2 out of 52 out of 5     Points: 2

update tablename set fieldname = controlname.text

where fieldname = control name

same for delete

delete from tablename where fieldname = controlname.text


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : send query for update and delete
Previous : Help need with Regular Expression in C#
Return to Discussion Forum
Post New Message
Category:

Related Messages

Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2013 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.