Getting ADO Error - String Truncation 
Author Message
 Getting ADO Error - String Truncation

Hiya,
I have a command (stored procedure - MS SQL Server 7) which has a
parameter which writes to a TEXT (long data, like memo) field, and
uses the Appendchunk method to append all the data.  My code
calculates the exact data length,and appends that. But when I say
command.Execute I get the following error:
Number = -2147217887
Description = [Microsoft][ODBC SQL Server Driver]String data, right
truncation
Source = Microsoft OLE DB Provider for ODBC Drivers
My Getchunk does not cause any problems, but that actually uses a
recordset object, not a command.
Anyone can advise as to what's wrong?

Thanks,
Sarah



Tue, 13 Apr 2004 23:45:29 GMT  
 Getting ADO Error - String Truncation
The length of a text column is 16. Is that long enough?


Quote:
> Hiya,
> I have a command (stored procedure - MS SQL Server 7) which has a
> parameter which writes to a TEXT (long data, like memo) field, and
> uses the Appendchunk method to append all the data.  My code
> calculates the exact data length,and appends that. But when I say
> command.Execute I get the following error:
> Number = -2147217887
> Description = [Microsoft][ODBC SQL Server Driver]String data, right
> truncation
> Source = Microsoft OLE DB Provider for ODBC Drivers
> My Getchunk does not cause any problems, but that actually uses a
> recordset object, not a command.
> Anyone can advise as to what's wrong?

> Thanks,
> Sarah



Thu, 15 Apr 2004 07:31:14 GMT  
 Getting ADO Error - String Truncation

Quote:

> The length of a text column is 16. Is that long enough?



> > Hiya,
> > I have a command (stored procedure - MS SQL Server 7) which has a
> > parameter which writes to a TEXT (long data, like memo) field, and
> > uses the Appendchunk method to append all the data.  My code
> > calculates the exact data length,and appends that. But when I say
> > command.Execute I get the following error:
> > Number = -2147217887
> > Description = [Microsoft][ODBC SQL Server Driver]String data, right
> > truncation
> > Source = Microsoft OLE DB Provider for ODBC Drivers
> > My Getchunk does not cause any problems, but that actually uses a
> > recordset object, not a command.
> > Anyone can advise as to what's wrong?

> > Thanks,
> > Sarah

Hiya!
The length of the Text Pointer is 16, the field is actually variable
length up to 2GB.  Nope, that ain't the problem.  Anything else?

Thanks,
Sarah



Sun, 02 May 2004 00:41:08 GMT  
 Getting ADO Error - String Truncation
The following code is working for me...

-- SQL Table, SP

CREATE TABLE [dbo].[photo] (
        [image_id] [float] NOT NULL ,
        [veh_id] [float] NOT NULL ,
        [comment] [varchar] (50) NULL ,
        [photo] [image] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

CREATE PROCEDURE writePhoto





AS


        INSERT INTO photo (image_id, veh_id, comment, photo)




' VB CODE
Public Function writePhoto(imageID As Long, _
                            vehID As Double, _
                            notes As String, _
                            imageSource As String) As Long

    'Declare err variable and objects
    Dim adoErr As ADODB.Error
    Dim cmdWritePhoto As ADODB.Command
    Dim param As ADODB.Parameter
    Dim lngRVal As Long

    Dim intFile As Integer
    Dim ImgBuff() As Byte
    Dim ImgLen As Long

    ' Declare and instantiate object variables
    On Error GoTo Err_Handler
    Set cmdWritePhoto = New ADODB.Command

    lngRVal = 0

    'Set Command object Properties
    With cmdWritePhoto

        .CommandType = adCmdStoredProc
        .CommandText = "writePhoto"
        .ActiveConnection = adoConn

        'Set parameters for stored proc call
        Set param = .CreateParameter("image_id", adDouble,
adParamInput, 0, imageID)
        .Parameters.Append param

        Set param = .CreateParameter("veh_id", adDouble, adParamInput,
0, vehID)
        .Parameters.Append param

        Set param = .CreateParameter("comment", adVarChar,
adParamInput, 50, notes)
        .Parameters.Append param

        'Read/Store GIF file in ByteArray
        intFile = FreeFile
        Open imageSource For Binary As #intFile
        ImgLen = LOF(intFile)
        ReDim ImgBuff(ImgLen) As Byte
        Get #intFile, , ImgBuff()
        Close #intFile

        Set param = .CreateParameter("photo", adLongVarBinary,
adParamInput, (ImgLen + 1))
        .Parameters.Append param

        'Set the Value of the parameter with the AppendChunk method.
        .Parameters("photo").AppendChunk ImgBuff()

        .Execute

    End With

'Exit Function
GoTo exit_Function
Err_Handler:

    ' Error handling here

exit_Function:

    Set cmdWritePhoto = Nothing
    Set param = Nothing

    writePhoto = lngRVal

End Function

Quote:


> > The length of a text column is 16. Is that long enough?



> > > Hiya,
> > > I have a command (stored procedure - MS SQL Server 7) which has a
> > > parameter which writes to a TEXT (long data, like memo) field, and
> > > uses the Appendchunk method to append all the data.  My code
> > > calculates the exact data length,and appends that. But when I say
> > > command.Execute I get the following error:
> > > Number = -2147217887
> > > Description = [Microsoft][ODBC SQL Server Driver]String data, right
> > > truncation
> > > Source = Microsoft OLE DB Provider for ODBC Drivers
> > > My Getchunk does not cause any problems, but that actually uses a
> > > recordset object, not a command.
> > > Anyone can advise as to what's wrong?

> > > Thanks,
> > > Sarah

> Hiya!
> The length of the Text Pointer is 16, the field is actually variable
> length up to 2GB.  Nope, that ain't the problem.  Anything else?

> Thanks,
> Sarah



Sun, 09 May 2004 05:29:20 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Getting ADO Error- String Truncation

2. string truncation with crystal reports 8.5 and sql server 7

3. Right String Truncation in SQLServer 2000

4. 01004 - 0 - [Microsoft][ODBC SQL Server Driver]String data, right truncation

5. -2147217889 [ODBC SQL Server Driver] String Data, Right Truncation

6. String Truncation

7. Truncation Issue w/ Strings

8. ADO to excel truncation

9. Data Truncation Error

10. Migrating from DAO to ADO Getting Error 3021

11. Getting useful error codes from ADO/ODBC/SQL

12. Flexgrid populated from ADO control - getting error on large tables

 

 
Powered by phpBB® Forum Software