Mysql et api

midgorn Messages postés 1 Date d'inscription lundi 23 octobre 2000 Statut Membre Dernière intervention 12 septembre 2003 - 12 sept. 2003 à 13:43
nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 - 12 sept. 2003 à 21:53
bonjour, j essaye d'acceder a une base mysql avec vb.
j'utilise l'api mysql.
apparemment la connection se passe bien , mais au moment d'executer une requete, la connection est perdu, j obtiens le message d'erreur "MySql server gone away'

Si qqun pouvait m'aider ça serait sympa :)

voici mon code :

Dim pMySQL As Long
Dim myErrorCode As Long
Dim pMyErrorMsg As Long
Dim myErrorMsg As String
Dim pMyROW As Long, myROW As Long, pMyRES As Long, i As Long
pMySQL = mysql_init(0)
If mysql_real_connect(pMySQL, "localhost", "moto", "", "root", 0, "0", 0) = 0 Then
If (mysql_query(pMySQL, "SELECT * FROM test") <> 0) Then
MsgBox "Instruction INSERT a echouer"
pMyErrorMsg = mysql_error(pMySQL)
myErrorMsg = CopieChaine(pMyErrorMsg)
MsgBox myErrorMsg

Else
MsgBox "Instruction INSERT a reussi"

End If



Else
MsgBox "connexion echouer"
End If
mysql_close (pMySQL)

1 réponse

nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 37
12 sept. 2003 à 21:53
Regardes les sources de VBFRANCE, il y a deja un exemple fonctionnel dedans

A+
0
Rejoignez-nous