When I implement a stored proc in this way, I do not get a valid cost valid error:
return (integer) comm.ExecuteScalar (); When I execute it in SQL Server, it returns 1, so I know that my work is working.
What's wrong with my artists?
Updated:
Public Static Instance (String Username, Int InTime) {SqlConnection connObj = New SqlConnection (); ConnObj.ConnectionString = Util SQLConct (); ConnObj.Open (); SqlCommand comm = New SqlCommand ("usp_IsUserLocked", connObj); Comm.CommandType = CommandType.StoredProcedure; com. Parameter. Add (new SQLPamator ("Username", Username)); Comm.parameters.Add (new SQLParamator ("@InInime", InTime)); Return (integer) comm.ExecuteScalar (); } Thanks in advance
It is possible that your method is double Or returns 64 or any other kind of returns, which can not be applied to embedded. Use Convert.ToInt32 to ensure that your method gives the right type. using the system; ... Convert Return ToInt32 (comm.ExecuteScalar ());
Comments
Post a Comment