Cathy30
04-07-2011, 08:17 AM
Hi
iam working with vb.net and ms access i have a error in the below coding
Private Sub Save_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save_Button.Click
If Code_TextBox.Text <> "" And Name_TextBox.Text <> "" Then
'Dim conn As New SqlConnection(connstr)
Dim code, Name As String
code = Code_TextBox.Text
Name = Name_TextBox.Text
str = "insert into Table1 values(" & code & "," & Name & ")"
cn.Open()
cmd = New OleDbCommand(str, cn)
cmd.ExecuteNonQuery() -------> The error is "No value given for one or more required parameters."
cn.Close()
Clear()
MsgBox("Records Saved")
Else
MsgBox("Fields cannot be empty")
End If
End Sub
Help plz
iam working with vb.net and ms access i have a error in the below coding
Private Sub Save_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save_Button.Click
If Code_TextBox.Text <> "" And Name_TextBox.Text <> "" Then
'Dim conn As New SqlConnection(connstr)
Dim code, Name As String
code = Code_TextBox.Text
Name = Name_TextBox.Text
str = "insert into Table1 values(" & code & "," & Name & ")"
cn.Open()
cmd = New OleDbCommand(str, cn)
cmd.ExecuteNonQuery() -------> The error is "No value given for one or more required parameters."
cn.Close()
Clear()
MsgBox("Records Saved")
Else
MsgBox("Fields cannot be empty")
End If
End Sub
Help plz