Bonjour
J'ai hésité à poursuivre ce fil de pepito62 -> http://www.developpez.net/forums/d63...22-delphi-6-a/
J'ai essayé différents moyens de me connecter à Mysql 5.0.67
Parmi mes tentatives : libmysql.dll et l'unité qui va avec mySQL.pas
J'arrive bien à me connecter à la base mysql, mais j'ai deux problèmes
1 - je n'arrive pas a créer à la volée un database
2 - je voulais essayer de passer une requete sql directement , mais je ne sais pas comment lui faire faire
J'ai essayé de remplacer la DLL téléchargée par la DLL de mysql5.0.67
Toujours la meme erreur Exception machin
Donc en fait, pour le moment je peut rien faire.
Je suis coincé...
Je vous livre mon brouillon de code
CONNECTION MYSQL -> OK
CREATION DATABASE -> ERREUR
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 public mysql: PMysql; CONST dbname='immouser'; ... procedure TForm1.Button1Click(Sender: TObject); Var user,host,pwd:string; portip:integer; begin user:='root'; pwd:=''; host:='localhost'; portip:=3306; MySQL := mysql_init(nil); mysql_options(mysql,MYSQL_OPT_COMPRESS,0); if mysql_real_connect(mysql, pChar(host), pChar(user), pChar(pwd), nil, portip, nil, 0)=nil then Label1.Caption:='La connexion a echouée' else Label1.Caption:='Connexion OK';
Je continue a fouiner
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 public mysql: PMysql; CONST dbname='immouser'; ... procedure TForm1.Button2Click(Sender: TObject); Var user,host,pwd:string; portip:integer; begin user:='root'; pwd:=''; host:='localhost'; portip:=3306; MySQL := mysql_init(nil); mysql_options(mysql,MYSQL_OPT_COMPRESS,0); if mysql_real_connect(mysql, pChar(host), pChar(user), pChar(pwd), nil, portip, nil, 0)=nil then Label3.Caption:='La connexion a echouée' else Label3.Caption:='Connexion OK'; if mysql_create_db(mysql, pChar(dbname))<>0 then Label2.Caption:='La création a echouée' else Label2.Caption:='Création OK';
![]()
Partager