Link to home
Start Free TrialLog in
Avatar of Jessee
JesseeFlag for Australia

asked on

VB6 MySQL Delete statement not working

Hey,

For some reason this code isnt working. Can you see any problems with it?
IP has been dotted out for obvious reasons :)

Thanks!
Set SQLCn = New ADODB.Connection
Set Cmd2 = New ADODB.Command

SQLCn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=*.*.*.*;" & " DATABASE=jessee10;" & "UID=jessee10_User;PWD=Password;"
SQLCn.Open

With Cmd2
    .ActiveConnection = SQLCn
    .CommandType = adCmdText
    .CommandText = "DELETE * FROM tblSongs WHERE colSongTitle = ? AND colBackupName = ? AND colUserIndex = ?"
    .Prepared = True
    .Parameters.Append .CreateParameter(, adVarChar, adParamInput, 100, SongName)
    .Parameters.Append .CreateParameter(, adVarChar, adParamInput, 100, BackupName)
    .Parameters.Append .CreateParameter(, adVarChar, adParamInput, 10, UserIndex)
    .Execute
End With

MesI "Record has been deleted."

Open in new window

Avatar of Jessee
Jessee
Flag of Australia image

ASKER

Im getting the error:

[MySQL][ODBC 3.51 Driver][mysqld-5.0.91-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM tblSongs WHERE colSongTitle = 'Miss Bipolar' AND colBackupName = 'Backup'' at line 1
ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

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 Jessee

ASKER

Ty