Solved

VB6 MySQL Delete statement not working

Posted on 2010-08-12
3
581 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now