Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating data source using parameters
Message
From
24/09/2003 10:08:26
 
 
To
24/09/2003 09:48:19
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00831808
Message ID:
00831819
Views:
38
Why not just use this:

cmd.CommandText = "UPDATE orpay SET depdate='" & @depdate1 & "' WHERE tag=1";

It will save you an RPC.

HTH

Wes






>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform