[thelist] Oops! Parameters in ASP.Net
Anthony Baratta
anthony at baratta.com
Tue Oct 30 11:23:52 CDT 2007
First you really should be using a stored procedure.
> ' Create, execute command
> comm = New SqlCommand("INSERT into RecordsDaily ( RecordsID_rec,BookingDay_rec) values ( @MainID, @Num1)", conn)
> comm.Parameters.Add("@MainID", Data.SqlDbType.Int)
> comm.Parameters.Add("@Num1", Data.SqlDbType.Int)
> comm.ExecuteNonQuery()
Second you are not passing the values to the parameters.
Third I would just do it this way:
> comm = New SqlCommand("INSERT into RecordsDaily ( RecordsID_rec,BookingDay_rec) values ( "
+ MainID.ToString()
+ ", "
+ Num1.ToString() + ")", conn)
> comm.ExecuteNonQuery()
More information about the thelist
mailing list