I would recommend tracing your code and find the line of code that causes the error to occur. It sounds like the error is on your ExecuteNonQuery line and the SQL Server stored procedure is returning it. If that is the case then you will need to test your stored procedure to find the cause of the error. Another thing to check is the value of the parameter you are sending. Make sure it is the right data type and contains valid information from the TextBox Text property.
>I write following code for insert record.
>
>Dim invenConn As SqlConnection = New SqlConnection("Data Source=DEVELOPE;Integrated Security=SSPI;" & _
> "Initial Catalog=inventory")
>
>Dim Invecmd As SqlCommand = New SqlCommand("INSERTGODOWN", invenConn) 'Declare For Sql Command
> Invecmd.CommandType = CommandType.StoredProcedure
> Dim MyParm As SqlParameter 'Declare For Parameters
> MyParm = Invecmd.Parameters.Add("@godname", SqlDbType.VarChar, 15)
> MyParm.Value = LTrim(txtGodownName.Text)
> invenConn.Open()
>Invecmd.ExecuteNonQuery()
>Invenconn.Close()
>Invecmd.Dispose()
>Invenconn.Dispose()
>
>Executing above code follwoing message occure
>
>an unhandled execption of type 'System.data.Sqlclient.Sqlexecption'
>occurred in syystem.data.dll
>
>Aditional information : system error.
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi