I
Ivan Weiss
I am getting this error from my error handler
The following error has occurred: 5 - No value given for one or more
required parameters.
Here is the code (two separate procedures)
Private Sub butDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butDelete.Click
Dim mySqlString As String
mySqlString = "DELETE from Customers WHERE Cust_ID = '" &
ListView.SelectedItems(0).Text.ToString & "'"
If MsgBox("Are you sure you wish to delete the selected
customer?", MsgBoxStyle.YesNo, "Deleting Customer. . .") =
MsgBoxResult.Yes Then
modify(Me, mySqlString)
fillListView(Me, sqlSelectCustomer)
End If
End Sub
And the code in my module performing my database operations
Public Sub modify(ByVal argControlForm As Object, ByVal argSql As
String)
Dim myConnection As New OleDbConnection(dbConnString)
Dim myCommand As New OleDbCommand()
argControlForm.cursor = Cursors.WaitCursor
With myCommand
.Connection = myConnection
.CommandType = CommandType.Text
.CommandText = argSql
End With
Try
myConnection.Open()
myCommand.ExecuteNonQuery()
Catch
DisplayErrorMessage("modDBSubs:modify")
Finally
If myConnection.State = ConnectionState.Open Then
myConnection.Close()
End If
argControlForm.cursor = Cursors.Default
End Try
End Sub
If anyone has any suggestions or ideas please let me know!
-Ivan
The following error has occurred: 5 - No value given for one or more
required parameters.
Here is the code (two separate procedures)
Private Sub butDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butDelete.Click
Dim mySqlString As String
mySqlString = "DELETE from Customers WHERE Cust_ID = '" &
ListView.SelectedItems(0).Text.ToString & "'"
If MsgBox("Are you sure you wish to delete the selected
customer?", MsgBoxStyle.YesNo, "Deleting Customer. . .") =
MsgBoxResult.Yes Then
modify(Me, mySqlString)
fillListView(Me, sqlSelectCustomer)
End If
End Sub
And the code in my module performing my database operations
Public Sub modify(ByVal argControlForm As Object, ByVal argSql As
String)
Dim myConnection As New OleDbConnection(dbConnString)
Dim myCommand As New OleDbCommand()
argControlForm.cursor = Cursors.WaitCursor
With myCommand
.Connection = myConnection
.CommandType = CommandType.Text
.CommandText = argSql
End With
Try
myConnection.Open()
myCommand.ExecuteNonQuery()
Catch
DisplayErrorMessage("modDBSubs:modify")
Finally
If myConnection.State = ConnectionState.Open Then
myConnection.Close()
End If
argControlForm.cursor = Cursors.Default
End Try
End Sub
If anyone has any suggestions or ideas please let me know!
-Ivan