Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating data source using parameters
Message
From
24/09/2003 09:48:19
 
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Updating data source using parameters
Miscellaneous
Thread ID:
00831808
Message ID:
00831808
Views:
54
hi,

i'm trying to update my database using an ExecuteNonQuery(), but i'm getting an error message 'system error'. i've narrowed it down to the parameter @depdate1 bec i tried setting depdate='01/01/2001' and it worked fine. my guess is i'm not using the parameter correctly. any ideas? thanks.


// date1 is the date today (from a date picker control)
cn.Open();
SqlCommand cmd = cn.CreateCommand();
MessageBox.Show(date1.ToString());
cmd.Parameters.Add("@depdate1",SqlDbType.SmallDateTime);
cmd.CommandText = "UPDATE orpay SET depdate=@depdate1 WHERE tag=1";
MessageBox.Show(cmd.ExecuteNonQuery().ToString());
cn.Close();



ERROR MESSAGE GENERATED

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

Additional information: System error.
Next
Reply
Map
View

Click here to load this message in the networking platform