Solved

VB6 MySQL Delete statement not working

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

792 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