ADO Object in VB Script Only Calls SQLGetData for column 1
From: Melanie Garvin (Garvin_at_discussions.microsoft.com)
Date: 10/15/04
- Next message: Kevin Yu [MSFT]: "Re: Error handling for ADO"
- Previous message: GL: "ADO and "Bad" Dates"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 15 Oct 2004 16:01:04 -0700
I am currently writing a test script in Visual Basic that performs a simple
query and then displays the data via the debug.write command. No matter what
I try I can only get the script to retrieve the first column of my query. I
have reviewed the ODBC trace file and can tell that vb is connecting to the
data source and executing the query. The problem seems to be that vb is not
doing a SQLBindCol followed by SQLFetch but is doing SQLGetData instead.
This would work correctly but vb seems to only be asking for SQLGetData for
column 1 each time. I am including my script incase it is something I am
doing wrong. Has anyone ever had this problem before?
Private Sub Command1_Click()
Dim adoConnection As ADODB.Connection
Dim adoRecordset As ADODB.Recordset
Dim connectString As String
Dim avarRecords As Variant
Dim intRecord As Integer
'—Create a new connection --
Set adoConnection = New ADODB.Connection
'—Create a new recordset --
Set adoRecordset = New ADODB.Recordset
adoRecordset.CursorType = adOpenStatic
adoRecordset.CursorLocation = adUseClient
'—Build our connection string to use when we open the connection --
connectString = "DSN=sc_report_odbc;UID=falcon;PWD=x"
adoConnection.Open connectString
Set adoRecordset = adoConnection.Execute("SELECT
number,contact.name,category,subcategory FROM probsummarym1")
Debug.Print "Probsummary Records"
Do While Not adoRecordset.EOF
Debug.Print vbTab & adoRecordset(0) & vbTab & adoRecordset(1) & vbTab & _
adoRecordset(2) & vbTab & adoRecordset(3)
adoRecordset.MoveNext
Loop
End Sub
- Next message: Kevin Yu [MSFT]: "Re: Error handling for ADO"
- Previous message: GL: "ADO and "Bad" Dates"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|