hi friends...
The following code is for getting tables list from specific database from MySql...
#include <windows.h>
#include <iostream>
#include <mysql/mysql.h>
using namespace std;
int main()
{
//connection params
char *host = "localhost";
char *user = "root";
char *pass = "";
char *db = "prakash";
//sock
MYSQL *sock;
sock = mysql_init(0);
if (sock) cout << "sock handle ok!" << endl;
else {
cout << "sock handle failed!" << mysql_error(sock) << endl;
}
//connection
if (mysql_real_connect(sock, host, user, pass, db, 0, NULL, 0))
cout << "connection ok!" << endl;
else {
cout << "connection fail: " << mysql_error(sock) << endl;
}
//connection character set
cout << "connection character set: " << mysql_character_set_name(sock) << endl;
//wait for posibility to check system/mysql sockets
system("PAUSE");
//closing connection
mysql_close(sock);
return EXIT_SUCCESS;
}
This is the first time i am using MySql with Dev C++...(This works fine)
I don't know how get the field name and field value of specific table..
I tried on google, but found like above code (List tables from specific database) ...
Can u help me to just display the field name and field value of specific table..