I am trying to use VB.NET to update a record in my database. I am using the below code:
When it gets to the SqlUpdateCommand1.ExecuteNonQuery() it crashes out and says:Code:Dim RowsAffected As Integer = 0 SqlConnection1.Open() With SqlUpdateCommand1 .Parameters("@Company_ID").Value = "COMPID" .Parameters("@Company_Name").Value = "COMPNAME" .Parameters("@Contract").Value = "CONTRACT" .Parameters("@Original_ID").Value = 2 End With SqlUpdateCommand1.ExecuteNonQuery() SqlConnection1.Close()The SQL Update statement it should be attempting to execute is below:An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.Does anyone know what this problem could be or how to fix it? From my understanding I am doing everything correctly and that error means absolutely nothing to me (gives NO detail).UPDATE TEST SET Company_ID = @Company_ID, Contract = @Contract, Company_Name = @Company_Name WHERE (ID = @Original_ID); SELECT ID, Company_ID, Contract, Company_Name FROM TEST WHERE (ID = @ID)




Reply With Quote