SQL statement problem [Resolved]
This code executes than refreshes my List Box but it doesn't actually delete the record in the database. Anyone have any ideas?
VB Code:
Private Sub cmdRemove_Click()
'Deletes Current Record
If (MsgBox("Are you sure you want to delete this record?", vbYesNo + vbDefaultButton2 + vbExclamation, "Remove User") = vbYes) Then
Execute fn, "DELETE FROM Users WHERE UserName = " & " 'txtUserName.Text' "
LoadUserListBox
End If
End Sub
Public Sub Execute(FileName As String, SQL As String)
Dim MyConnection As New ADODB.Connection
Dim MyRecordset As New ADODB.Recordset
MyConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FileName
MyConnection.Mode = adModeShareDenyNone
If MyConnection.State <> adStateOpen Then
MyConnection.Open
End If
MyConnection.Execute SQL
End Sub
Re: SQL Statement Problem
Problem Fixed
VB Code:
Execute fn, "DELETE FROM Users WHERE UserName = '" & txtUserName.Text & "'"
Re: SQL statement problem [Resolved]