Link to home
Start Free TrialLog in
Avatar of danorme
danorme

asked on

Deleting record from SQL

I have a program that allows employees to upload and delete files from a shared drive.  I got the upload to work 100% and the delete to work 50%.

The files are listed in a VB listbox which are stored in SQL.
My delete process does delete the file from the shared drive, but does not delete the record from SQL.  Here is my code THAT DOES NOT WORK.
        Dim sSQL As String
        Dim conn As SqlConnection = New SqlConnection("integrated security=SSPI;data source=SERVERNAME;persist security info=False;initial catalog=DATABASE")
        Dim comm As New SqlCommand
        sSQL = "DELETE * FROM loanfiles WHERE ([lnfile]=" & (lstUploadedFiles.Text) & ");"
        comm.Connection = conn
        comm.CommandText = sSQL
        conn.Open()
        comm.ExecuteNonQuery()
        conn.Close()

I am getting a syntax error on comm.ExecuteNonQuery()

This is urgent.  Please help.
ASKER CERTIFIED SOLUTION
Avatar of wtconway
wtconway

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wtconway
wtconway

Oh yeah. I totally overlooked that. You also don't require the parentheses or the semicolon.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of danorme

ASKER

PERFECT!!!!!!