G
Guest
I have been trying to delete a record with the following code, but not
receiving any results, not even an error message. I have verified that I am
passing a valid record index and that my connection is correct. I'm new to
ADO.Net and this is driving me crazy. Thanks in advance.
Private Sub RecDel(ByVal intRecIndex As Integer)
Try
Me.Cursor = Cursors.WaitCursor
Dim myConnection As New SqlConnection(strSqlConnection)
myConnection.Open()
strSqlCommand = "SELECT * FROM USAD_10Digit WHERE RecIdx = " &
intRecIndex
Dim myCommand As New SqlCommand(strSqlCommand, myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()
Catch
If Err.Number <> 0 Then
MsgBox("Error:" & Str(Err.Number) & ControlChars.CrLf & _
Err.Description & ControlChars.CrLf & _
"Generated by " & Err.Source, _
MsgBoxStyle.Critical, Application.ProductName)
End If
Finally
Me.Cursor = Cursors.Default
End Try
End Sub
receiving any results, not even an error message. I have verified that I am
passing a valid record index and that my connection is correct. I'm new to
ADO.Net and this is driving me crazy. Thanks in advance.
Private Sub RecDel(ByVal intRecIndex As Integer)
Try
Me.Cursor = Cursors.WaitCursor
Dim myConnection As New SqlConnection(strSqlConnection)
myConnection.Open()
strSqlCommand = "SELECT * FROM USAD_10Digit WHERE RecIdx = " &
intRecIndex
Dim myCommand As New SqlCommand(strSqlCommand, myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()
Catch
If Err.Number <> 0 Then
MsgBox("Error:" & Str(Err.Number) & ControlChars.CrLf & _
Err.Description & ControlChars.CrLf & _
"Generated by " & Err.Source, _
MsgBoxStyle.Critical, Application.ProductName)
End If
Finally
Me.Cursor = Cursors.Default
End Try
End Sub