you have to add this
sqlComm.Parameters.AddWithValue("FirstName", txtName.Text)
Private Sub InsertNewRecord()
sqlCon = New SqlConnection(strConn)
Using (sqlCon)
Dim sqlComm As New SqlCommand()
sqlComm.Connection = sqlCon
sqlComm.CommandText = "InsertDataIntoTable"
sqlComm.CommandType = CommandType.StoredProcedure
sqlComm.Parameters.AddWithValue("FirstName", txtName.Text)
sqlComm.Parameters.AddWithValue("Surname", txtSurname.Text)
sqlComm.Parameters.AddWithValue("Age", Integer.Parse(txtAge.Text))
sqlCon.Open()
sqlComm.ExecuteNonQuery()
End Using
End Sub
Source: https://www.codeguru.com/visual-basic/using-sql-stored-procedures-with-vb-net
No comments:
Post a Comment