VB6 + ADO 2.7 Une chaîne SQL retourne .EOF alors qu'il y a des lignes.

laurent_diep Messages postés 4 Date d'inscription mercredi 3 mars 2004 Statut Membre Dernière intervention 14 octobre 2006 - 7 déc. 2005 à 10:24
laurent_diep Messages postés 4 Date d'inscription mercredi 3 mars 2004 Statut Membre Dernière intervention 14 octobre 2006 - 7 déc. 2005 à 13:49
Hello everybody,

Je suis sur VB6 avec ADO 2.7 qui pointe sur une base Oracle.

J'ai une erreur étrange :

Je créé une chaîne SQL dans le code et elle retourne EOF et quand je mets cette chaîne directement dans Oracle (via Toad) elle retourne des lignes.

J'ai essayé une requête plus simple dans VB et cela a marché : J'ai remarqué qu'au delà de 3 tables dans la clause from le code plante: il ne retourne pas d'erreurs mais la requête retourne EOF.

Ce code marche avec une base Access.

Voici mon code :

'***************************************<WBR>**********<WBR>**********<WBR>**********<WBR>**********<WBR>**********<WBR>******

Public Sub CreateProfileByChemistrySignificantLigan<WBR>dFamilyArr<WBR>ay()

'***************************************<WBR>**********<WBR>**********<WBR>**********<WBR>**********<WBR>**********
'* Remplit le tableau varProfileByChemistryLigandFamilyArray
'* avec les familles de ligands selectionnes (via les targets selectionnees)
'***************************************<WBR>**********<WBR>**********<WBR>**********<WBR>**********<WBR>**********

Dim RsADODBRecordset As ADODB.Recordset
Dim strSQL As String

On Error GoTo Err_CreateProfileByChemistrySignificantL<WBR>igandFamil<WBR>yArray

varProfileByChemistryLigandFamilyArray = Empty
Set RsADODBRecordset = New ADODB.Recordset
Set RsADODBRecordset.ActiveConnection = CnADODBConnection

Screen.MousePointer = vbHourglass

'Create ProfileByChemistry significant ligand family Array
strSQL = "SELECT E.Fa_Code"
strSQL = strSQL & " FROM " & strBioDataTable & " A, " & strLigandDictionnaryTable & " B, Tmp_Ch_Target C, "
strSQL = strSQL & strLigandFamilyRelation & " D, " & strLigandFamily & " E" strSQL strSQL & " Where A.Li_ID B.Li_ID And A.Ta_ID = C.Target And B.Li_ID = D.Li_ID And D.Fa_ID = E.Fa_ID" strSQL strSQL & " And C.Jeto_ID" & gBytCurrentCounter
strSQL = strSQL & " GROUP BY E.Fa_Code HAVING count(*)>=5"

RsADODBRecordset.Open strSQL
If RsADODBRecordset.BOF False Or RsADODBRecordset.EOF False Then
varProfileByChemistryLigandFamilyArray = RsADODBRecordset.GetRows(400000)
End If

Screen.MousePointer = vbNormal

Exit Sub

Err_CreateProfileByChemistrySignificantL<WBR>igandFamil<WBR>yArray:

Select Case Err.Number

Case Else

MsgBox "Err_CreateProfileByChemistrySignificant<WBR>LigandFami<WBR>lyArray : " & Err.Number & " " & Err.Description
Resume Next

End Select

End Sub

'***************************************<WBR>**********<WBR>**********<WBR>**********<WBR>**********<WBR>**********<WBR>******

Merci beaucoup pour vos réponses.

laurent_diep.

2 réponses

cs_vpoyo Messages postés 363 Date d'inscription vendredi 14 février 2003 Statut Membre Dernière intervention 20 avril 2010 6
7 déc. 2005 à 10:51
salut, tu peux essayer avec ce code car je viens juste d'avoir le même pb mais en passant par les proc stock, et en ouvrant le recordset ainsi ca marche.

dim oCmd as ADODB.Command

set oCmd = new Command
oCmd.ActiveConnection = CnADODBConnection
oCmd.CommandText = strSQL
oCmd.CommantType = adCmdText

set RsADODBRecordset = new Recordset
RsADODBRecordset.Open cmd, , adOpenStatic, adLockReadOnly

Vincent
0
laurent_diep Messages postés 4 Date d'inscription mercredi 3 mars 2004 Statut Membre Dernière intervention 14 octobre 2006
7 déc. 2005 à 13:49
Merci mille fois ! : çà a l'air de marcher : tu m'as fait gagner un temps précieux !

Laurent.
0
Rejoignez-nous