Wednesday, February 15, 2012

ERROR: String or binary data would be truncated.

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

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

/maxwebportal/inc_footer.asp, line 121

Thanks for ANY assistance. I'm pretty much new at this. <CHRIS>

>>>Code Below...Scroll Down for Line 121:

if exceer=okoame then

if CurPageInfoChk = "" then
strOnlineLocation = "Unknown page"
else
if CurPageType = "forums" and trim(strRqForumID) <> "" then
'## Forum_SQL - load the user list
strSql = "SELECT " & strTablePrefix & "FORUM.F_PRIVATEFORUMS FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & strRqForumID & " AND F_PRIVATEFORUMS <> 0"

set rsPrf = my_Conn.Execute(strSql)

if not (rsPrf.BOF and rsPrf.EOF) then
isPrivateForum = 1
else
isPrivateForum = 0
end if

rsPrf.Close
set rsPrf = nothing

end if
if not CurPageInfo () = "" then
if isPrivateForum = 1 then
strOnlineLocation = "Private Page"
else
strOnlineLocation = CurPageInfo ()
end if
else
strOnlineLocation = "Hidden page"
end if
end if

strOnlineUser = OnlineSQLencode(strOnlineUser)
strOnlineLocation = OnlineSQLencode(strOnlineLocation)
strOnlineTimedOut = strOnlineCheckInTime - 1500 'time out the user after 25 minutes
strSql = "SELECT " & strTablePrefix & "ONLINE.UserID, " & strTablePrefix & "ONLINE.UserIP, " & strTablePrefix & "ONLINE.LastChecked"
strSql = strSql & " FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE " & strTablePrefix & "ONLINE.UserIP='" & strOnlineUserIP & "' AND " & strTablePrefix & "ONLINE.UserID='" & strOnlineUser & "'"
set rsWho = my_Conn.Execute (strSql)

if rsWho.eof or rsWho.bof then
' THEY ARE A NEW USER SO INSERT THERE USERNAME
on error resume next
Set objRS2 = Server.CreateObject("ADODB.Recordset")
strSQL = "INSERT INTO " & strTablePrefix & "ONLINE (UserID,UserIP,DateCreated,CheckedIn,LastChecked,M _BROWSE) VALUES ('"
strSql = strSQL & strOnlineUser & "','" & strOnlineUserIP & "','" & strOnlineDate & "','" & strOnlineCheckInTime & "','" & strOnlineCheckInTime & "','" & strOnlineLocation & "')"
my_Conn.Execute (strSql)
if err.number <> 0 then response.write err.number & "|" & err.description
else
' THEY ARE A ACTIVE USER
strSql = "SELECT " & strTablePrefix & "ONLINE.UserID, " & strTablePrefix & "ONLINE.UserIP, " & strTablePrefix & "ONLINE.LastChecked"
strSql = strSql & " FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE " & strTablePrefix & "ONLINE.UserID='" & strOnlineUser & "' AND " & strTablePrefix & "ONLINE.UserIP = '" & strOnlineUserIP & "'"
set rsLastChecked = my_Conn.Execute (strSql)

' LETS UPDATE THE TABLE SO IT SHOWS THERE LAST ACTIVE VISIT
strSql = "UPDATE " & strTablePrefix & "ONLINE SET M_BROWSE='" & strOnlineLocation & "' , LastChecked='" & strOnlineCheckInTime & "' WHERE UserID='" & strOnlineUser & "' AND " & strTablePrefix & "ONLINE.UserIP='" & strOnlineUserIP & "'"
my_Conn.Execute (strSql) << Line 121<<<<<<<This error occurs when the data you are inserting into your column exceeds the data width specified for the column. Check your DDL and insert statement to find out the particular column.

No comments:

Post a Comment