Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/2277?pagenum=1
05 November 2025, 01:57
Topic
slemieux
String or binary data would be truncated
22 November 2000, 18:00
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]<
Replies ...
HuwR
22 November 2000, 18:08
There is a size limit when posting using ado, around 7000 chars
'Resistance is futile'<
gor
23 November 2000, 01:17
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
23 November 2000, 02:30
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
23 November 2000, 13:00
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 ======<
HuwR
07 December 2000, 05:32
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
07 December 2000, 14:57
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
07 December 2000, 15:27
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
07 December 2000, 15:57
Someone who uses MYSQL will have to comment on that
'Resistance is futile'<
work mule
08 December 2000, 01:26
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
08 December 2000, 01:31
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
08 December 2000, 03:45
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
08 December 2000, 10:57
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
08 December 2000, 11:16
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
08 December 2000, 14:15
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
08 December 2000, 20:09
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<
slemieux
08 December 2000, 21:40
Think MS will ever have a useful site where real people can find real answers?
Since I have never had this problem anywhere else I am betting it's this server with the issue (not that it couldn't be others). The two things that are typically screwy are MDAC and ODBC. And while I would almost always bet the farm on MDAC, I searched the knowledge base and found this So if this forum isn't using ODBC, then I just wasted a bunch of bandwidth As far as MySQL it's been a couple months since I worked with it, but it is 100% ANSI SQL compliant, so the instert statement shouldn't be a problem. MySQL supports recordsets but last I checked didn't support any type of locking or cursor location.
Anyone simply tried changing the way this forum connects to the database? I use SQLOLEDB without any problems.
Scott LeMieux<
HuwR
08 December 2000, 22:25
Thanks MS, that's a really useful article.
'Resistance is futile'<
work mule
09 December 2000, 13:39
quote:Since I have never had this problem anywhere else I am betting it's this server with the issue
I tried to taking the same information that I tried to post on Snitz and posted it on my development forum at home. It posted with no problem. On here (Snitz) I received the error that I posted earlier in this topic.
<
HuwR
09 December 2000, 14:44
quote:
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
This doesn't appear to work in mysql.
In the who's online mod, in onine2.asp, is the following code
if rsWho.eof or rsWho.bof then
Set objRS2 = Server.CreateObject("ADODB.Recordset") objRS2.Open "FORUM_ONLINE", objConn, 1, 2, 2 objRS2.AddNew objRS2("UserID") = User objRS2("Status") = "LOGIN" objRS2("DateCreated") = fDate objRS2("CheckedIn") = CheckInTime objRS2("M_BROWSE") = Location objRS2.Update objRS2.close else strSql = "UPDATE FORUM_ONLINE SET M_BROWSE = '" & Location & "' , DateCreated = '" & fDate & "' WHERE UserID = '" & User & "'" my_Conn.Execute (strSql) end if
Using mysql it fails with the following error 3219 | Operation is not allowed in this context. if you change the code to
if rsWho.eof or rsWho.bof then on error resume next Set objRS2 = Server.CreateObject("ADODB.Recordset") strSQL = "INSERT INTO " & strTablePrefix & "ONLINE ( UserID,Status,DateCreated,CheckedIn,M_BROWSE) VALUES (" strSql = strSQL & User & ",'LOGIN','" & fDate & "','" & CheckInTime & "','" & Location & "')" my_Conn.Execute (strSql) if err.number <> 0 then response.write err.number & "|" & err.description else strSql = "UPDATE FORUM_ONLINE SET M_BROWSE = '" & Location & "' , DateCreated = '" & fDate & "' WHERE UserID = '" & User & "'" my_Conn.Execute (strSql) end if
everything works OK.
'Resistance is futile'<
Doug G
09 December 2000, 16:02
quote:Since I have never had this problem anywhere else I am betting it's this server with the issue (not that it couldn't be others). The two things that are typically screwy are MDAC and ODBC. And while I would almost always bet the farm on MDAC, I searched the knowledge base and found this
When I read this article, it sounded like an explanation of why you might receive an error message using ODBC vs. ISQL, not what the error message actually was.
I don't find much info on 80040e57 either, though. ====== Doug G ======
Edited by - Doug G on 09 December 2000 16:03:23<
tilttek
10 December 2000, 12:18
quote: This doesn't appear to work in mysql.
In the who's online mod, in onine2.asp, is the following code
if rsWho.eof or rsWho.bof then
Set objRS2 = Server.CreateObject("ADODB.Recordset") objRS2.Open "FORUM_ONLINE", objConn, 1, 2, 2 objRS2.AddNew objRS2("UserID") = User objRS2("Status") = "LOGIN" objRS2("DateCreated") = fDate objRS2("CheckedIn") = CheckInTime objRS2("M_BROWSE") = Location objRS2.Update objRS2.close else strSql = "UPDATE FORUM_ONLINE SET M_BROWSE = '" & Location & "' , DateCreated = '" & fDate & "' WHERE UserID = '" & User & "'" my_Conn.Execute (strSql) end if
Using mysql it fails with the following error 3219 | Operation is not allowed in this context. if you change the code to
if rsWho.eof or rsWho.bof then on error resume next Set objRS2 = Server.CreateObject("ADODB.Recordset") strSQL = "INSERT INTO " & strTablePrefix & "ONLINE ( UserID,Status,DateCreated,CheckedIn,M_BROWSE) VALUES (" strSql = strSQL & User & ",'LOGIN','" & fDate & "','" & CheckInTime & "','" & Location & "')" my_Conn.Execute (strSql) if err.number <> 0 then response.write err.number & "|" & err.description else strSql = "UPDATE FORUM_ONLINE SET M_BROWSE = '" & Location & "' , DateCreated = '" & fDate & "' WHERE UserID = '" & User & "'" my_Conn.Execute (strSql) end if
everything works OK.
I did look at you code closely and sould work. What's objConn?
Philippe Gamache http://www.tilttek.com http://www.lapageamelkor.com<
HuwR
10 December 2000, 12:36
Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = strConnString objConn.Open
'Resistance is futile'<
tilttek
11 December 2000, 08:57
quote:
Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = strConnString objConn.Open
'Resistance is futile'
In objRS2.Open "FORUM_ONLINE", objConn, 1, 2, 2 change it for objRS2.Open "FORUM_ONLINE", strConnString, 1, 2, 2
I don't have my code here, nor my book, so I can't validate... I'm at work in Java... But looking at the code I did send, this might do the trick. I'll try to retest this...
Philippe Gamache http://www.tilttek.com http://www.lapageamelkor.com<
HuwR
15 December 2000, 06:10
According to IIS
To optimize performance, avoid using the ADO record addition and deletion methods, such as AddNew and Delete. If your application adds and deletes records intensively, your application will perform better if it uses direct SQL statements, such as INSERT.
'Resistance is futile'<
tilttek
15 December 2000, 09:28
quote:
According to IIS
To optimize performance, avoid using the ADO record addition and deletion methods, such as AddNew and Delete. If your application adds and deletes records intensively, your application will perform better if it uses direct SQL statements, such as INSERT.
Good thing to know... But I think they mean More that 1 Record at once.
Philippe Gamache http://www.tilttek.com http://www.lapageamelkor.com<
HuwR
15 December 2000, 09:39
tiltek,
did you manage to find out why I was getting the error on MYSQL ?
'Resistance is futile'<
tilttek
15 December 2000, 15:32
I didn't have the time to look at it... I know there are some problems with ADO (it's documented on MySQL site), but it's not our problem. Are you using MySQL (I don't remember if it install its self with MySQL for Window)?
I hope to have time to look at it this week end. But I'm not sur. I wont be at home very often.
Philippe Gamache http://www.tilttek.com http://www.lapageamelkor.com<
HuwR
15 December 2000, 15:52
I don't use it, I was hust testing some install scripts for the Mods, so I figured I would test the whole site.
'Resistance is futile'<
Reinsnitz
05 January 2001, 14:40
Considering this a feature of the Database in question/Hardware the DB is running on as opposed to a forum related issue.
Closing This and it's sibling topic at: http://forum.snitz.com/forum/link.asp?TOPIC_ID=1518 also, I'm moving this topic to the FAQ forum for Heptite to note in her work there.
Reinsnitz (Mike) ><)))'>
"The glory of young men is their strength, and the honor of old men is their gray hair." - Proverbs 20:29 <