HMoellendorf
asked on
mySQL Connection - How to get it working?
Hi there.
I've just downloaded
http://tangentsoft.net/mysql++/
But I don't know, what I have to do now.
Could someone give me a short statement?
Thanks
Henning
I've just downloaded
http://tangentsoft.net/mysql++/
But I don't know, what I have to do now.
Could someone give me a short statement?
Thanks
Henning
But I don't know, what I have to do now.
Could someone give me a short statement?
Er? (Is that short enough?)
Seriously. What do you want to know?
Could someone give me a short statement?
Er? (Is that short enough?)
Seriously. What do you want to know?
ASKER
I don't know, how to import the libmysql.dll!
refer this with src code...
http://www.codeguru.com/cpp/cpp/cpp_mfc/general/article.php/c10041__2/
MAHESH
http://www.codeguru.com/cpp/cpp/cpp_mfc/general/article.php/c10041__2/
MAHESH
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay, I've now added to the dependencies the libmysql.lib file.
The script is now running.
But how do I now access the Functions of libmysql?
The script is now running.
But how do I now access the Functions of libmysql?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi folks,
now it works so far:
I can open a connection.
But I want to write a class, which manages the db-connection.
But I don't know, how I make MYSQL *conn; working class-wide.
Henning
now it works so far:
I can open a connection.
But I want to write a class, which manages the db-connection.
But I don't know, how I make MYSQL *conn; working class-wide.
Henning
ASKER
Additional, It works.
But I can't output the value of a field in a MessageBox.
The command:
MessageBox(NULL, (char) "Test", TEXT("TEst"), MB_OK);
The error, errorcode: C2664:
Konvertierung des Parameters 2 von 'char' in 'LPCWSTR' nicht möglich
Conversion of Parameter 2 from 'char' to 'LPCWSTR' not possible.
Can someone help me?
But I can't output the value of a field in a MessageBox.
The command:
MessageBox(NULL, (char) "Test", TEXT("TEst"), MB_OK);
The error, errorcode: C2664:
Konvertierung des Parameters 2 von 'char' in 'LPCWSTR' nicht möglich
Conversion of Parameter 2 from 'char' to 'LPCWSTR' not possible.
Can someone help me?
Looks like you might be building with Unicode support - was that your intention?
ASKER
I dunno.
I need to output the content of the rows.
But I don't get it.
Do you know, why?
I need to output the content of the rows.
But I don't get it.
Do you know, why?
Can you post what you've got so far (if it isn't too long; if it is then try to post the bare minimum to get your point across)
ASKER
#CODE BEGIN
#include "stdafx.h"
#include "stdio.h"
#include "windows.h"
#include "dbmanager.h"
database_manager::database _manager() {
mySqlPointer = NULL;
}
database_manager::~databas e_manager( ) {
mysql_close(mySqlPointer);
}
bool database_manager::connect( ) {
mySqlPointer = mysql_init(NULL);
if(mysql_real_connect(mySq lPointer, "HOST", "USER", "PASS", "DB", 3306, NULL, 0)) {
return true;
}
else
{
return false;
}
}
int database_manager::doQuery( const char *query) {
int res;
if(mysql_query(mySqlPointe r, "SELECT * FROM ij_user"))
{
MessageBox(NULL, TEXT("Fehler"), TEXT("Test"), MB_OK);
}
else
{
unsigned int num_fields;
unsigned int i;
mySqlRes = mysql_use_result(mySqlPoin ter);
num_fields = mysql_num_fields(mySqlRes) ;
while(mySqlRow = mysql_fetch_row(mySqlRes)) {
for(i = 0; i < num_fields; i++) {
MessageBox(NULL, (LPCWSTR) mySqlRow[i], TEXT("Test"), MB_OK);
}
}
}
return 1;
}
#END CODE
The result is now many squares, but no real data...
#include "stdafx.h"
#include "stdio.h"
#include "windows.h"
#include "dbmanager.h"
database_manager::database
mySqlPointer = NULL;
}
database_manager::~databas
mysql_close(mySqlPointer);
}
bool database_manager::connect(
mySqlPointer = mysql_init(NULL);
if(mysql_real_connect(mySq
return true;
}
else
{
return false;
}
}
int database_manager::doQuery(
int res;
if(mysql_query(mySqlPointe
{
MessageBox(NULL, TEXT("Fehler"), TEXT("Test"), MB_OK);
}
else
{
unsigned int num_fields;
unsigned int i;
mySqlRes = mysql_use_result(mySqlPoin
num_fields = mysql_num_fields(mySqlRes)
while(mySqlRow = mysql_fetch_row(mySqlRes))
for(i = 0; i < num_fields; i++) {
MessageBox(NULL, (LPCWSTR) mySqlRow[i], TEXT("Test"), MB_OK);
}
}
}
return 1;
}
#END CODE
The result is now many squares, but no real data...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://tangentsoft.net/mysql++/doc/userman/html/index.html