Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Form the help of code project members i learn about the ado connection in the c programming..

but the problem is that the program provide the up normal Termination..

my coding is:


#include "stdafx.h"
#include <windows.h>
#include <stdio.h>

#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename("EOF", "EndOfFile")

struct StartOLEProcess{
StartOLEProcess( ) {
::CoInitialize(NULL);
}
~StartOLEProcess( ) {
::CoUninitialize( );
}[]
} _start_StartOLEProcess;

//connection string
ADODB::_ConnectionPtr Con = NULL;

//record set

ADODB::_RecordsetPtr RecSet = NULL;

//single Field Pointer

ADODB::FieldPtr Field;

//Record affected pointer

VARIANT *RecordsAffected = NULL;

//importing Ole variable

StartOLEProcess OLEVar;

int main(int argc, char* argv[])
{
if(Con.CreateInstance(__uuidof(ADODB::Connection)) == 0)
{
printf("sucess\n");

}
Con->ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Server=MyRemoteHost;""Port=3306;Option=4;Database=db;Uid=root;Pwd=""";
Con->ConnectionTimeout = 30;

Con->Open("","","",0);

printf("hai\n");
return 0;
}

my database is mysql..
database name is db1
my user name is root;
and password is nothing..

what is the wrong in that .. why it producing error
Posted
Updated 24-Jul-11 21:10pm
v2

No.

Have you installed MySQL and the MySql Connector C++[^]?
 
Share this answer
 
I think you have to give reference to one of the header files in order to get the sql statements working. I found this website, where it does not use mysql.h but a different header file. Hope this is helful.

http://www.enderunix.org/documents/eng/mysql++.html[^]

This website also shows how to install MySQL for C++. So that should give you a start and may be you can also get your MySQL.h file


Let me know if it worked. I have not tested it myself though.

--
AJ
 
Share this answer
 
Check in the directory tree that the SDK was installed into. There should probably be a subdirectory called include which will hold the header file. Just add that directory name to your include search path.
 
Share this answer
 
Everything you need is here
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900