MySQL Insert and VB6


I am currently using the VB6 statement

MySQLQuery("INSERT INTO clients VALUES ('" & vbvar1 & "', '" & vbvar2 & "', '" & vbvar3 &"')")

to insert records into my mysql database which worked fine until I needed to add an auto_increment value to my client table.

In mysql the auto increment syntax is

INSERT INTO `clients` (`column1`,`column2`,`column3`) VALUES ('Tom', 'Dick', 'Harry');

I would guess that this converts to vb in the following way
MySQLQuery("INSERT INTO '`clients`' ('`column1`','`column2`','`column3`') VALUES ('" & vbvar1 & "','" & vbvar2 & "','" & vbvar3 & "')")
but it does not.

Does anyone have any ideas.

Sorry if my explanation is a little confusing.
I created the MySQLQuery() function myself and it works fine. The issue I am having is representing MySQL column and table names in vb.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!