un fichier "text.txt" était limité en carractère
librairie MySQL.
je code en C++ [...] j'aimerais savoir comment on fait pour se connecté a MySQL.
après j'ai marqué "librairie MySQL" parce que c'est des .lib.. merci de me corriger quand j'emploi pas les bon mots..
se que sa ma apporté
encore merci a vous j’espère que sa va m'aider.
je sais que dans les forums on aime pas le langage sms
les erreur sont dans ws2def.h et winsock2.h
If you get a huge number of compiler errors (WS2DEF.H and WINSOCK2.H) and you are using Visual C++ 2008 (9.0) Express under Windows XP, then you should try to include winsock.h instead of winsock2.h in fimysql.h.
You don't really use the extra stuff winsock2.h has to offer, such as IPv6 or Bluetooth for mySQL anyway - to my best knowledge. At least this is how I managed to solve my 160 compiler errors, and it works like a charm!
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include #include <stdlib.h> #include <winsock.h> #include "D:\EasyPHP-5.3.8.1\mysql\lib\fichiers d'entète\mysql.h" #define IP_DB "localhost" #define LOGIN_DB "root" #define PASS_DB "" #define NAME_DB "TEST" using namespace std; void main (void) { int i; unsigned int NombreColonne; MYSQL *mysql; mysql = mysql_init(NULL); mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "option" ); if(mysql_real_connect(mysql, IP_DB, LOGIN_DB, PASS_DB, NAME_DB, 0, NULL, 0)==NULL) cout << "Erreur : Connexion DB impossible" << endl; else { if(mysql_query(mysql, "SELECT * FROM `table`" ) == 0) cout << "OK" << endl; else cout << mysql_error(mysql) << endl; MYSQL_RES *Resultat = NULL; MYSQL_ROW row=NULL; //On met le jeu de résultat dans le pointeur result Resultat = mysql_store_result(mysql); if (Resultat && mysql_num_rows(Resultat)) NombreColonne = mysql_num_fields(Resultat); while ((row=mysql_fetch_row(Resultat))!=NULL) { for(i=0; i<NombreColonne;i++) cout<<"["<<row[i]<<"]"; cout<<endl; } mysql_close(mysql); } }