Index (zero based) must be greater than or equal to zero and less than the size of th
Can you tell me why I am getting the following error from the given code?
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Code is
Private Sub btnIssue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIssue.Click
Dim objCommand As OleDb.OleDbCommand = New OleDb.OleDbCommand()
objCommand.Connection = OleDbConnection1
objCommand.CommandText = "INSERT INTO TRANS(BOOKNO,MEMBERNO) VALUES (@bookno,@memberno)"
objCommand.CommandType = CommandType.Text
objCommand.Parameters.Add("@bookno", editNo)
objCommand.Parameters.Add("@memberno", editIssue)
Try
OleDbConnection1.Open()
objCommand.ExecuteNonQuery() --> ERROR IN THIS LINE
OleDbConnection1.Close()
MessageBox.Show("Book issued", "Issue", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch x As System.Exception
MessageBox.Show(x.ToString, "error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub