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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only