Author |
Topic  |
slemieux
Junior Member
 
USA
234 Posts |
Posted - 22 November 2000 : 18:00:03
|
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]< |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 22 November 2000 : 18:08:49
|
There is a size limit when posting using ado, around 7000 chars
'Resistance is futile'< |
 |
|
gor
Retired Admin
    
Netherlands
5511 Posts |
Posted - 23 November 2000 : 01:17:01
|
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< |
 |
|
Davio
Development Team Member
    
Jamaica
12217 Posts |
Posted - 23 November 2000 : 02:30:31
|
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. 
*----*----*----*----*----*----*----*----*----*----*----* "However, if you suffer as a Christian, do not be ashamed, but praise God that you bear that name." 1 Peter 4:16< |
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 07 December 2000 : 05:32:45
|
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'< |
 |
|
tilttek
Junior Member
 
Canada
333 Posts |
Posted - 07 December 2000 : 14:57:17
|
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< |
 |
|
isuru
Junior Member
 
464 Posts |
Posted - 07 December 2000 : 15:27:52
|
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 < |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 07 December 2000 : 15:57:46
|
Someone who uses MYSQL will have to comment on that
'Resistance is futile'< |
 |
|
work mule
Senior Member
   
USA
1358 Posts |
Posted - 08 December 2000 : 01:26:54
|
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.
< |
 |
|
work mule
Senior Member
   
USA
1358 Posts |
Posted - 08 December 2000 : 01:31:32
|
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. 
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
< |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 December 2000 : 03:45:08
|
Both ways are using ADO, the way the forum does it is to execute an SQL query,the example tilttek showed was using the properties of the ADO recordset to set it's values.
I am not sure that all recordset properties are supported by all the diferent DB drivers.
We need a mysql user to comment on this so we can decide what best to do.
'Resistance is futile'< |
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 08 December 2000 : 10:57:43
|
If you're taking votes from disinterested parties, I vote to use an INSERT SQL statement instead of a recordset whenever possible. I don't have MySQL, however I would think a recordset object can be used with a MySQL backend.
====== Doug G ======< |
 |
|
tilttek
Junior Member
 
Canada
333 Posts |
Posted - 08 December 2000 : 11:16:12
|
I did work ADO with: - SQL Server 6.5, 7.0
- Access 9x, 2000
- Oracle
- SQL Anyware
- MySQL
And using this method, was the fastest and safest way to implement into all of them. First you don't have the DATE format difference, you don't need to have many SQL Statement depending of the DB used, and you don't have the 2k Page limit of SQL Server 6.5...
And yes MySQL can use this way... Maybe internaly it recreate a Insert.... But we don't care.
Did a software that had to work with all of them, and that was the way to do it. I'm programming on the web for about 6 years. And 11 years as pass, from the first time I use Usenet and FTP.
Yes I'm new here... But not on the web.
Philippe Gamache http://www.tilttek.com http://www.lapageamelkor.com< |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 December 2000 : 14:15:32
|
Thanks for the info tilttek, I think this will be a major coding change, but maybe short term would solve the message posting.
I shall take a look and let Mike and Gor know what I think.
'Resistance is futile'< |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 December 2000 : 20:09:00
|
Hmmm,
We need more info from people with this problem. I have just succesfully posted > 60000 chars against both my SQL and Access DB's using the forum?
I'm sure it didn't work before.
Anyway, my version of ADO is 2.5
'Resistance is futile'
I just installed MySQL on by home server, and successfully posted the same message to the MySQL DB.
I would therfore summise it is not a problem with the forum code, but a driver specific problem.
Edited by - huwr on 08 December 2000 21:26:23< |
 |
|
Topic  |
|