exceter Posted August 11, 2004 Posted August 11, 2004 Sub UpdateDBdata(ByVal docID As String, ByVal Revision As String) Try Dim connection As New SqlConnection("Server=it; Initial Catalog=qs; User ID=sa; pwd=sqldata") Dim command As New SqlCommand("UpdateRev", connection) command.CommandType = CommandType.StoredProcedure Dim param_Revision As SqlParameter param_Revision = command.Parameters.Add("@Rev_n", SqlDbType.Char, 6) param_Revision.Value = "REVVV" Dim param_ID As SqlParameter param_ID = command.Parameters.Add("@DocID", SqlDbType.Int) param_ID.Value = docID connection.Open() command.ExecuteNonQuery() connection.Close() Catch ex As Exception checkError.Text = ex.ToString() checkError.Visible = True End Try End Sub The Debugger shows error: System.FormatException: Input string was not in a correct format. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Test.Grid.UpdateDBdata(String docID, String Revision) in C:\Inetpub\wwwroot\Test\Grid.aspx.vb:line 140 Quote
VBAHole22 Posted August 11, 2004 Posted August 11, 2004 I believe that when you are using a SQLCommand object that is calling a stored procedure you need to set the CommandType, which you did, as well as the CommandText, which is the name of the stored proc. I'm also not sure that you need the '@' symbol in your parameter names. Try changing those 2 things and see if you get a different error message, or better yet, working code. Quote Wanna-Be C# Superstar
Administrators PlausiblyDamp Posted August 11, 2004 Administrators Posted August 11, 2004 What is the value of docID when you are getting this error? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
exceter Posted August 12, 2004 Author Posted August 12, 2004 Thanks, Handled the Error, the code works fine now. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.