dbTalk Databases Forums  

mysql++-1.7.1-win32-vc++ insert query problem with MYSQL 4.1

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss mysql++-1.7.1-win32-vc++ insert query problem with MYSQL 4.1 in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
karthikeyan (Offline)
Junior Member
 
Posts: 2
Join Date: Jun 2006

Question mysql++-1.7.1-win32-vc++ insert query problem with MYSQL 4.1 - 06-28-2006 , 09:06 AM






Hi All
I’m newbie to CPP. I have installed MYSQL server version 4.1 in my
windows machine. Recently I have downloaded the
mysql++-1.7.1-win32-vc++. It seems to be lib (Mysql++.lib) build was fine. I
tried to compile and run the samples that come with mysql connector. The
select query examples were successfully executed. When I try to insert the
data in to MYSQL DB it returns the following error message


Query : INSERT INTO stock (item,num,weight,price,sdate) VALUES (Hot
Dogs,100,1.5
,1.75,1998-09-25)
Error: You have an error in your SQL syntax; check the manual that
corresponds t
o your MySQL server version for the right syntax to use near
'Dogs,100,1.5,1.75,
1998-09-25)' at line 1

What does it meant? Is the mysql++-1.7.1-win32-vc++ supports only MYSQL
version 3.x? Then I downloaded the newer version of mysql++, which is
2.1.1. It seems to be building libs with VS C++7.0 was fine. In this version insert
queries are fruitfully working with MYSQL version 4.1. My development should be in VC ++6.0.
Is there any way to run the Insert query using mysql++-1.7.1-win32-vc++
against MYSQL 4.1 or can I able to use library in VC ++6.0, which was builded
in VS C++7.0 .

The quick replay will be greatly appreciated.

Thanks,
Karthikeyan AT

Reply With Quote
  #2  
Old   
karthikeyan (Offline)
Junior Member
 
Posts: 2
Join Date: Jun 2006

Lightbulb 06-29-2006 , 03:04 AM






Hi ALL,
I have resolved the problem myself. Hence the basic difference between the insert query in Mysql 3.x and Mysql 4.x is

OLD Versions of Mysql.
INSERT INTO stock (item,num,weight,price,sdate) VALUES (Hot
Dogs,100,1.5,1.75,1998-09-25)

New Versions of Mysql.
INSERT INTO stock (item,num,weight,price,sdate) VALUES ('Hot Dogs',100,1.5,1.75,'1998-09-25')

So I slightly modified the custom2.cpp code like
//row.set("Hot Dogs", 100, 1.5, 1.75, "1998-09-25");
//query.insert(row);
query.execute("INSERT INTO stock (item,num,weight,price,sdate) VALUES ('Hot Dogs',100,1.5,1.75,'1998-09-25')");

It's working for me.

Thanks
Karthikeyan AT

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.