
August 20th, 2004, 02:36 PM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Cannot create the database from C++
I want to create the mysql database using C++ and MYSQL API.
Since mysql_create_db function is deprecated I am little bit confused how do I create a new database using C++.
I tried the following code . But for my luck that also didn't work!!!
strcpy(sqlSmt,"create database Test");
if ((dataBase = mysql_init((MYSQL *)0)) &&
mysql_real_connect(dataBase,"localhost","host",NULL,NULL,MYSQL_PORT,NULL,0)) {
if (mysql_query(dataBase,sqlSmt) < 0) {
printf("Cannot create the database Test from %s\n",dataBase);
mysql_close(dataBase);
return 2;
}
}
I am very new to MYSQL. I will be greatful if someone assit me .
Thank you,
Ashwini
|