Pb vb6 ODBC requette qui ce lance pas !

Résolu
fredericmaill Messages postés 144 Date d'inscription mercredi 16 juin 2004 Statut Membre Dernière intervention 22 mars 2006 - 27 nov. 2004 à 23:07
fredericmaill Messages postés 144 Date d'inscription mercredi 16 juin 2004 Statut Membre Dernière intervention 22 mars 2006 - 28 nov. 2004 à 01:26
J'ai un pb sous vb 6 avec le lancement d' une requette sql,
j'utilise une base Mysql et un driver ODBC, lors de l'execution de mon programme le debugeur me precise " ce pilote ODBC , ne prend pas en charge les propriété demander"
il me rencvoie a ma requette : rs_Count_client.Open "Count num_client As [nbclient] From client", cn_client, adOpenDynamic, adLockOptimistic
merci de m'aider !!

vive VB !!!, vive la prog !!!

7 réponses

cs_frop01 Messages postés 1352 Date d'inscription lundi 27 octobre 2003 Statut Membre Dernière intervention 19 novembre 2008 2
27 nov. 2004 à 23:42
salut,

Tu n'aurais pas oulié un ptit select dans ta requete :

rs_Count_client.Open "Select count (num_client) As nbclient From client", cn_client, adOpenDynamic, adLockOptimistic


:-p [mailto:cyberscorp2004@msn.com MSN] :big) [mailto:frop01@yahoo.fr YAHOO] >:)

Membre du club CodeS-SourceS
3
fredericmaill Messages postés 144 Date d'inscription mercredi 16 juin 2004 Statut Membre Dernière intervention 22 mars 2006
27 nov. 2004 à 23:54
oui c vraiq quelle etourdis !!!

mais appres rectification :

rs_Count_client.Open "Select count (num_client) As nbclient From client", cn_client, adOpenDynamic, adLockOptimistic

vb ml'indique encore :

erreur d'exécution : ce pilote ODBC ne prend pas en charge la propriété demandé

:( :(


vive VB !!!, vive la prog !!!
3
cs_frop01 Messages postés 1352 Date d'inscription lundi 27 octobre 2003 Statut Membre Dernière intervention 19 novembre 2008 2
28 nov. 2004 à 01:20
juste une ptite question

pourquoi faire une requete pour verifiersi la table n'est pas vide ?

quand il existe la propriété RecordCount

tu passe directement

Public Sub CmdPremier_Click()
' pour ce positioner sur le premier client de la base MySQL

' verification si la table n'est pas vide

rs_client.CursorType = adOpenDynamic
rs_client.Open "Select * From client", cn_client

if rs_client.recordcount>0 then 

'récuperation des informations de la base

txtNumClient = rs_client("num_client")
txtNomClient = rs_client("societe")
txtContactClient = rs_client("contact")
txtAdresseClient = rs_client("adresse")
txtCpClient = rs_client("cp")
txtVilleClient = rs_client("ville")
TxtTelClient = rs_client("num_tel")
txtFaxClient = rs_client("num_fax")

Else

MsgBox "il n'existe aucun client dans la base"

End If

rs_client.Close

End Sub



:-p [mailto:cyberscorp2004@msn.com MSN] :big) [mailto:frop01@yahoo.fr YAHOO] >:)

Membre du club CodeS-SourceS
3
cs_frop01 Messages postés 1352 Date d'inscription lundi 27 octobre 2003 Statut Membre Dernière intervention 19 novembre 2008 2
28 nov. 2004 à 00:29
resalut,

Est-ce que la connexion à la base de données est correcte ??
Peut-on voir le code ?

cn_client.CursorLocation = adUseServer
cn_client.Open "DRIVER=.... ?

:-p [mailto:cyberscorp2004@msn.com MSN] :big) [mailto:frop01@yahoo.fr YAHOO] >:)

Membre du club CodeS-SourceS
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
fredericmaill Messages postés 144 Date d'inscription mercredi 16 juin 2004 Statut Membre Dernière intervention 22 mars 2006
28 nov. 2004 à 01:07
la connexion est bonne car j'arrive a faire des ajout dans la base

avec un update !!

mais voisi ma chaine de copnnexion :

Provider=MSDASQL.1;Persist Security Info=False;User ID=root;Data Source=gestion_clients;Initial Catalog=gestion_clients

elle fais appel a mon directement a mon driver MyODBC me permettant de mle connecté a ma base MySQL

mais puisque j'arrive a faire des ajous dans ma base, logiquement, la connexion est ok !!

vive VB !!!, vive la prog !!!
0
fredericmaill Messages postés 144 Date d'inscription mercredi 16 juin 2004 Statut Membre Dernière intervention 22 mars 2006
28 nov. 2004 à 01:11
voici le code qui bloque ::

Public Sub CmdPremier_Click()
' pour ce positioner sur le premier client de la base MySQL

' verification si la table n'est pas vide

rs_Count_client.CursorType = adOpenDynamic
rs_Count_client.Open "Select count (num_client) As nbclient From client", cn_client, adOpenDynamic, adLockOptimistic

If rs_Count_client("nbclient") <> 0 Then
MsgBox "test 1"

rs_client.CursorType = adOpenDynamic
rs_client.Open "Select * From client", cn_client

MsgBox "test 1"
If rs_client.BOF = False Then
MsgBox "test 1"
rs_client.MoveFirst

'récuperation des informations de la base

txtNumClient = rs_client("num_client")
txtNomClient = rs_client("societe")
txtContactClient = rs_client("contact")
txtAdresseClient = rs_client("adresse")
txtCpClient = rs_client("cp")
txtVilleClient = rs_client("ville")
TxtTelClient = rs_client("num_tel")
txtFaxClient = rs_client("num_fax")

Else

MsgBox "il n'existe aucun client dans la base"

End If

End If

rs_client.Close
rs_Count_client.Close

End Sub

vive VB !!!, vive la prog !!!
0
fredericmaill Messages postés 144 Date d'inscription mercredi 16 juin 2004 Statut Membre Dernière intervention 22 mars 2006
28 nov. 2004 à 01:26
je ne connaissais pas cette propriété !! merci !!

vive VB !!!, vive la prog !!!
0
Rejoignez-nous