Solved

VB6 MySQL Delete statement not working

Posted on 2010-08-12
3
590 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 60

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 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