OVH Cloud OVH Cloud

Probleme requete sur "Microsoft Text Driver"

2 réponses
Avatar
jp
Bonjour,

J'ai une requete qui ne passe pas et je ne comprend pas pourquoi !

Message d'alerte provenant de VB = Trop peu
de parametre. 1 attendu.

Merci..

FICHIER : SCHEMA.INI
'-------------------------------------------------------
[aa.txt]
ColNameHeader=False
Format=FixedLength
CharacterSet=OEM
MaxScanRows=0
CharacterSet=OEM
MaxScanRows=0
COL1=1 char width 5
COL2=6 char width 7
COL3=13 char width 4


FICHIER AA.TXT
'---------------------------------------------------------------------------
-
1234567890123456
1234567890123456
1234567890123456
1234567890123456
1234567890123456
1234567890123456
1234567890123456


REQUETE VB :
'---------------------------------------------------------------------------

Dim connCSV As New ADODB.Connection
Dim rsTest As New ADODB.Recordset
Dim adcomm As New ADODB.Command
Dim path As String

connCSV.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" _
& path & ";Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Info=False"


rsTest.Open "Select * From aa.txt order by col1", _
connCSV, adOpenStatic, adLockReadOnly, adCmdText
Do While Not rsTest.EOF
MsgBox rsTest(0)
rsTest.MoveNext
Loop

2 réponses

Avatar
DC
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.769 / Virus Database: 516 - Release Date: 24/09/2004
Avatar
DC
Bon(jour)(soir),

dans votre "schema.ini", le nom des colonnes est juste après les "colx=" où
x représente l'index de votre colonne.
C'est ces noms que vous devez utiliser dans vos requêtes et pas "colx".

Bon courage...

dc

"jp" a écrit dans le message de
news:
Bonjour,

J'ai une requete qui ne passe pas et je ne comprend pas pourquoi !

Message d'alerte provenant de VB = Trop peu
de parametre. 1 attendu.

Merci..

FICHIER : SCHEMA.INI
'-------------------------------------------------------
[aa.txt]
ColNameHeaderúlse
Format=FixedLength
CharacterSet=OEM
MaxScanRows=0
CharacterSet=OEM
MaxScanRows=0
COL1=1 char width 5
COL2=6 char width 7
COL3 char width 4


FICHIER AA.TXT



'---------------------------------------------------------------------------
-
1234567890123456
1234567890123456
1234567890123456
1234567890123456
1234567890123456
1234567890123456
1234567890123456


REQUETE VB :



'---------------------------------------------------------------------------

Dim connCSV As New ADODB.Connection
Dim rsTest As New ADODB.Recordset
Dim adcomm As New ADODB.Command
Dim path As String

connCSV.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" _
& path & ";Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Infoúlse"


rsTest.Open "Select * From aa.txt order by col1", _
connCSV, adOpenStatic, adLockReadOnly, adCmdText
Do While Not rsTest.EOF
MsgBox rsTest(0)
rsTest.MoveNext
Loop