Truncated data when using ADO.NET
From: Phil LaVigne (anonymous_at_discussions.microsoft.com)
Date: 05/24/04
- Next message: Chris: "Connect MS Access to Sybase using ADO"
- Previous message: Scot NS Curry: "How to monitor insert?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 May 2004 06:41:04 -0700
I have a very simple test script which is retrieving data from a table. The attributes of the table are an integer and a varchar(1000). When I turn on ODBC tracing I see the two calls to SQLGetData pass the buffer with a buffer length of 4092 and 4094 respectively. However; when the ODBC driver, I am using, gets the call the buffer lengths are 4092 and 201 respectively.
Why is the Driver Manager passing 201 and not 4094 to the driver.
Imports System
Imports System.Data
Imports System.Data.Odbc
Imports Microsoft.VisualBasic
Public Class test1_strlen200
Public Shared Sub Main()
Dim nwindConn As OdbcConnection = New OdbcConnection("Driver={NetezzaSQL};")
Dim catCMD As OdbcCommand = new OdbcCommand("select a_srno, a_char1000 from all_datatypes order by a_srno", nwindConn)
nwindConn.Open()
Dim myReader As OdbcDataReader = catCMD.ExecuteReader()
Do While myReader.Read()
Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))
Loop
myReader.Close()
nwindConn.Close()
End Sub
End Class
ODBC TRACE:
test1_strlen200 5a4-50c ENTER SQLExecDirectW
HSTMT 078C1DC8
WCHAR * 0x04935230 [ -3] "select a_srno, a_char1000 from all_datatypes order by a_srno\ 0"
SDWORD -3
test1_strlen200 5a4-50c EXIT SQLExecDirectW with return code 0 (SQL_SUCCESS)
HSTMT 078C1DC8
WCHAR * 0x04935230 [ -3] "select a_srno, a_char1000 from all_datatypes order by a_srno\ 0"
SDWORD -3
test1_strlen200 5a4-50c ENTER SQLNumResultCols
HSTMT 078C1DC8
SWORD * 0x0012F630
test1_strlen200 5a4-50c EXIT SQLNumResultCols with return code 0 (SQL_SUCCESS)
HSTMT 078C1DC8
SWORD * 0x0012F630 (2)
test1_strlen200 5a4-50c ENTER SQLFetch
HSTMT 078C1DC8
test1_strlen200 5a4-50c EXIT SQLFetch with return code 0 (SQL_SUCCESS)
HSTMT 078C1DC8
test1_strlen200 5a4-50c ENTER SQLGetData
HSTMT 078C1DC8
UWORD 1
SWORD -16 <SQL_C_SLONG>
PTR 1639528
SQLLEN 4092
SQLLEN * 0x0012F650
test1_strlen200 5a4-50c EXIT SQLGetData with return code 0 (SQL_SUCCESS)
HSTMT 078C1DC8
UWORD 1
SWORD -16 <SQL_C_SLONG>
PTR 1639528
SQLLEN 4092
SQLLEN * 0x0012F650 (4)
test1_strlen200 5a4-50c ENTER SQLGetData
HSTMT 078C1DC8
UWORD 2
SWORD -8 <SQL_C_WCHAR>
PTR 0x00190468
SQLLEN 4094
SQLLEN * 0x0012F64C
test1_strlen200 5a4-50c EXIT SQLGetData with return code 1 (SQL_SUCCESS_WITH_INFO)
HSTMT 078C1DC8
UWORD 2
SWORD -8 <SQL_C_WCHAR>
PTR 0x00190468 [ 400] "vQnJyeAAYe4X8ShhMHZ6-rT6zGtNuvxIrJqvx8TNFbDJZ9WD5gh Kj:4HrUavavW/jsNlNN8bN5c:jLsUi-CMFXKLGEA+yypbchBdC2u2nk/ey:pTKrEs-j .5W19w-g9lra5mHP "
SQLLEN 4094
SQLLEN * 0x0012F64C (400)
DIAG [01004] String data, right truncated (-2)
ODBC DRIVER TRACE:
SQLExecDirect: entering hDrvStmt = 0x7AD2CE0
statement_type: entering
statement_type: exiting type = 0
SC_clear_error: entering Stmt = 0x7AD2CE0
SC_clear_error: exiting
SQLNumParams: entering hDrvStmt = 0x7AD2CE0
SQLNumParams: exiting
copy_statement_with_parameters: entering
copy_statement_with_parameters: exiting sql stmt = 'select a_srno, a_char1000 from all_datatypes order by a_srno'
CC_send_query: send query
SQLExecDirectInternal: exiting result = 0
SQLExecDirect: exiting hDrvStmt = 0x7AD2CE0
SQLNumResultCols: entering hDrvStmt = 0x7AD2CE0
SC_clear_error: entering Stmt = 0x7AD2CE0
SC_clear_error: exiting
DC_get_num_fields: entering desc = 0x7AD2B20, num_fields = 2
SQLNumResultCols: exiting
SQLFetchScroll: entering hDrvStmt = 0x7AD2CE0, declarefetch = 0, status = 3
SC_clear_error: entering Stmt = 0x7AD2CE0
SC_clear_error: exiting
SC_fetch: result columns = 2
SC_fetch: lf=0, stmt = 0x7AD2CE0, stmt->bindings = 0x7AD2720, buffer[] = 0x0
SC_fetch: lf=1, stmt = 0x7AD2CE0, stmt->bindings = 0x7AD2720, buffer[] = 0x0
SC_fetch: exiting result = 0
SQLFetchScroll: exiting
SQLGetData: entering enter, hDrvStmt = 0x7AD2CE0, column = 1, bufsize = 4092
copy_and_convert_field: field_type = 'INT4', fctype = 'integer', value = '58', cbValueMax=4092
copy_and_convert_field: ret ind value = 4
copy_and_convert_field: exiting
SQLGetData: exiting
SQLGetData: entering enter, hDrvStmt = 0x7AD2CE0, column = 2, bufsize = 201
copy_and_convert_field: value addr = 0x12F4BC, max chars = 201
copy_and_convert_field: field_type = 'CHAR', fctype = 'char', value = 'vQnJyeAAYe4X8ShhMHZ6-rT6zGtNuvxIrJqvx8TNFbDJZ9WD5gh Kj:4HrUavavW/jsNlNN8bN5c:jLsUi-CMFXKLGEA+yypbchB', cbValueMax=201
copy_and_convert_field: ret ind value = 200
copy_and_convert_field: exiting
SQLGetData: exiting
Any help would be appreciated.
- Next message: Chris: "Connect MS Access to Sybase using ADO"
- Previous message: Scot NS Curry: "How to monitor insert?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|