Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update query?

Status
Not open for further replies.

lynque

IS-IT--Management
Sep 30, 2004
124
CA
Hello all,

I'm new to C# and am having some trouble with an update query

Code:
// create DB connection
string mydbdsn="server=SERVER; database=DB; user id=USER; pwd=PW;";
SqlConnection connection = new SqlConnection(mydbdsn);
connection.Open();

strNewABS="UPDATE <TABLE> SET <COLUMN> = 'L' WHERE ID = 1"; 
SqlCommand updateCommand = new SqlCommand(strNewABS, connection);
updateCommand.ExecuteNonQuery();

The update works in Query Analyser but not on the page.

Any help is much appreciated
 
Wrap this code in a try..catch block, and then paste in the contents of the exception's message property. Once we know what the exact error is, we might could help.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top