Article ID: 202621
Article Last Modified on 6/30/2004
/*** Object: Table dbo.tblTest ***/ CREATE TABLE dbo.tblTest ( Test text NOT NULL ) GO insert into tblTest (Test) VALUES (SPACE(255)) insert into tblTest (Test) VALUES (SPACE(256))
Dim DB As Database
Dim WS As Workspace
Dim RS As Recordset
Dim ssql As String, ConnectString As String
ConnectString = "ODBC;DRIVER={SQL SERVER};SERVER=<your SQL Server>;" & _
"DATABASE=pubs;UID=<username>;PWD=<strong password>;"
Set WS = Workspaces(0)
Set DB = WS.OpenDatabase("", dbDriverPrompt, False, ConnectString)
ssql = "Select * from tblTest"
Set RS = DB.OpenRecordset(ssql, dbOpenSnapshot, dbSQLPassThrough)
If RS.RecordCount > 0 Then
Do Until RS.EOF
Debug.Print Right(RS("Test"), 10) & ":" & Len(RS("Test")) & _
":" & Asc(Right(RS("Test"), 1))
'Notice that any item of text that is 256, 511, 766, 1,021...
'returns character 0 in the last character, and the
'actual last character is lost.
RS.MoveNext
Loop
End If
RS.Close
DB.Close
WS.Close
Set RS = Nothing
Set DB = Nothing
Set WS = Nothing
Additional query words: GetChunk AppendChunk ODBCDirect Direct SQLPassthrough
Keywords: kbbug kbfix kbdatabase KB202621