Solved

VB6 MySQL Delete statement not working

Posted on 2010-08-12
3
589 Views
Last Modified: 2012-06-27
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

0
Comment
Question by:Letsgetcoding
  • 2
3 Comments
 

Author Comment

by:Letsgetcoding
ID: 33426636
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
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 250 total points
ID: 33426879
Should be:

DELETE FROM tblSongs

instead of

DELETE * FROM tblSongs
0
 

Author Closing Comment

by:Letsgetcoding
ID: 33427774
Ty
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question