Here's the problem. I have a form that, among other things, asks 7 questions. The 7 questions are pulled from the database. When the user enters all of their answers and clicks Submit, I sometimes get a "String data, right truncation" error and can't figure out why. I am only putting less than a sentence or two into each textarea box. The Answer column in the database is defined as a varchar(4096) so it should be plenty big. The stored procedure is also expecting the Answer to come in as a varchar(4096). I just can't understand why sometimes it works and other times it gives a string truncation error. Any help would be much appreciated. Thanks!
Code:
Sub setVariables()
iTicketInfoID = Request.Form("iTicketInfoID")
iWhichTech = Request.form("WhichTech")
sRequestor = Request.Form("txtRequestor")
sCallSummary = Request.form("txtCallSummary")
dtCallCompleteDate = Request.Form("CallCompleteMonth") & "/" & Request.Form("CallCompleteDay") & "/" & Request.Form("CallCompleteYear")
sQuestion1 = Request.form("txtQuestion1")
sQuestion2 = Request.form("txtQuestion2")
sQuestion3 = Request.form("txtQuestion3")
sQuestion4 = Request.form("txtQuestion4")
sQuestion5 = Request.form("txtQuestion5")
sQuestion6 = Request.form("txtQuestion6")
sQuestion7 = Request.form("txtQuestion7")
if sQuestion7 = "" then sQuestion7 = NULL
End Sub
'set variables
setVariables
'test variables if necessary for testing
'testVariables
'connect to the database
Connection objConn
'build the command
BuildCommand cmdAction, objConn, "TrackItCallFeedback_UpdateInfo"
set rsAction = Server.CreateObject("ADODB.Recordset")
set rsAction = cmdAction.Execute(, array(iTicketInfoID, iWhichTech, sRequestor, sCallSummary, dtCallCompleteDate, iUserID, sIPAddress))
'build the command
BuildCommand cmdAction2, objConn, "TrackItCallFeedback_AddAnswer"
set rsAction2 = Server.CreateObject("ADODB.Recordset")
dim arrQuestions(6)
dim i
i = 0
arrQuestions(0) = sQuestion1
arrQuestions(1) = sQuestion2
arrQuestions(2) = sQuestion3
arrQuestions(3) = sQuestion4
arrQuestions(4) = sQuestion5
arrQuestions(5) = sQuestion6
arrQuestions(6) = sQuestion7
for i = 0 to 6
iQuestionID = i + 1
if arrQuestions(i) <> "" then
'Response.Write ("arrQuestions(" & i & ") = " & arrQuestions(i) & "<BR>")
set rsAction2= cmdAction2.Execute(, array(iTicketInfoID, iQuestionID, trim(arrQuestions(i)), iUserID, sIPAddress))
end if
next