String or binary data would be truncated - Postet den (2260 Views)
Junior Member
slemieux
Innlegg: 234
234
I assume this is a known issue here at forum.snitz.com

Microsoft OLE DB Provider for ODBC Drivers error '80040e57'
[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated.
/forum/post_info.asp, line 625

when posting a lengthy reply

Or is it a built in cut off to keep us from blabbing away
Scott LeMieux

[moved by admin on 01/06/2001]<
   
 Sidestørrelse 
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
There is a size limit when posting using ado, around 7000 chars

'Resistance is futile'<
Postet den
Retired Admin
gor
Innlegg: 5511
5511
Any objections if I move this out of here then into a FAQ forum ?
For the post to be here I would like it to be something we can fix in de source code.
Am I right that this only happens here or does it also happen with different databases than SQL Server ?

Pierre Gorissen
Even if you're on the right track,
you'll get run over if you just sit there.
Will Rogers<
Postet den
Development Team Member
Davio
Innlegg: 12217
12217
quote:
Am I right that this only happens here or does it also happen with different databases than SQL Server ?
I have no problem posting a message over 7000 chars in length using access. But I do get an 'exception occured' error when I try to post 87000 chars using access. bigsmile
*----*----*----*----*----*----*----*----*----*----*----*
"However, if you suffer as a Christian, do not be ashamed,
but praise God that you bear that name."
1 Peter 4:16
<
Postet den
Support Moderator
Doug G
Innlegg: 6493
6493
There is no inherent size limit on posting text to SQL server as long as the destination field is a TEXT field. Refer to http://support.microsoft.com/support/kb/articles/Q194/9/75.ASP

======
Doug G
======<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
I think we need to try and address this, it was discussed previously here
http://forum.snitz.com/forum/link.asp?TOPIC_ID=1518
The quote I posted was from a Technet CD, the issue is not with the DB, but the use of a single INSERT to post data > 9000 chars.
I have both an access and a SQL db, the error occurs on both. It may be an MDAC2.5 problem and be fixed in 2.6. So if you can tell us what ver you were using to
quote:
I have no problem posting a message over 7000 chars in length using access. But I do get an 'exception occured' error when I try to post 87000 chars using access



'Resistance is futile'<
Postet den
Junior Member
tilttek
Innlegg: 333
333
Hi, I'm only looking at Snitz... But It seem to be a very good forums. I didn't have time to look at the code but it seem you use a simple INSERT statement to add to the DB.
Using ADO it's not the best way.
Here some tip: use:

Dim objRecordset
Set objRecordset = Server.CreateObject("ADODB.Recordset")
' data in the table. objRecordset.Open "TableName",DB_CONNECTIONSTRING,adOpenKeyset,adLockPessimistic,adCmdText
objRecordset.AddNew
objRecordset.Fields("text_field") = CStr(WeekdayName(WeekDay(Date())))
objRecordset.Fields("integer_field") = CInt(Day(Now()))
objRecordset.Fields("date_time_field") = Now()
objRecordset.Update
' Get the DB assigned ID of the record we just added. iRecordAdded = objRecordset.Fields("id").Value
objRecordset.Close
Set objRecordset = Nothing

And if it's the way you already doing it.... It might be an other problem... SQL Memory Page Size for exemple... In version 6.5 it was realy a big problem... (2K Page).


Philippe Gamache
http://www.tilttek.com
http://www.lapageamelkor.com<
Postet den
Junior Member
isuru
Innlegg: 464
464
Unless Im mistaken that code doesn't use SQL.
Therefore it won't be compatible with all supported Databaes (eg MySQL) will it?
-=-=-=-=-=-=-=-
Isuru Amarasena bigsmile<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
Someone who uses MYSQL will have to comment on that

'Resistance is futile'<
Postet den
Senior Member
work mule
Innlegg: 1358
1358
I tried to post earlier in response to:
http://forum.snitz.com/forum/link.asp?TOPIC_ID=2547

I was going to post the code from a file that I was using. In my Text Editor, the document properties said it was 9,676 characters.
This promptly resulted in the following:

Microsoft OLE DB Provider for ODBC Drivers error '80040e57' 

[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated.

/forum/post_info.asp, line 625

Would it be possible to check for dbtype and do a case statement and optimize where possible for the different types of databases? Especially if there is an alternative way for SQL Server/Access that will work? I do remember seeing in the code that there were some areas where things were done differently for mysql.
<
Postet den
Senior Member
work mule
Innlegg: 1358
1358
If I'm not mistaken, isn't this still ADO? --> Server.CreateObject("ADODB.Recordset")

Or was the intent to show a better way to use ADO if we must use it?
Just curious. smile
quote:
Using ADO it's not the best way.
Here some tip: use:

Dim objRecordset
Set objRecordset = Server.CreateObject("ADODB.Recordset")
' data in the table. objRecordset.Open "TableName",DB_CONNECTIONSTRING,adOpenKeyset,adLockPessimistic,adCmdText
objRecordset.AddNew
objRecordset.Fields("text_field") = CStr(WeekdayName(WeekDay(Date())))
objRecordset.Fields("integer_field") = CInt(Day(Now()))
objRecordset.Fields("date_time_field") = Now()
objRecordset.Update
' Get the DB assigned ID of the record we just added. iRecordAdded = objRecordset.Fields("id").Value
objRecordset.Close
Set objRecordset = Nothing



<
Du må legge inn en melding