I have a table that contains an ntext data type field. I need to do a search on that field to see if a record exists in that table. I'm running a stored procedure, but the data may have a single quote in it. I've tried two ways to try to run the query/stored procedure within vbscript/ASP.
1.
set rstQuestionText = server.CreateObject("ADODB.Recordset"
with rstQuestionText
.CursorLocation = adUseClient
.Open "imagecareinc.get_question_text_from_text('" & strQuestionText & "')", cnn,,,adCmdStoredProc
end with
Obviously, if there is a single quote within the strQuestionText variable, it bombs.
So I tried using the command object.
2.
dim objCmd, objParam
set objParam = server.CreateObject("ADODB.Parameter"
set objCmd = server.CreateObject("ADODB.Command"
objCmd.ActiveConnection = cnn
objCmd.CommandText = "imagecareinc.get_question_text_from_text"
objCmd.CommandType = adcmdstoredproc
objParam.Attributes = adFldLong
objParam.Name = "QuestionText"
objParam.Type = adLongVarWChar
objParam.Direction = adParamInput
objParam.Size = 16
objParam.value = strQuestionText
objCmd.Parameters.Append objParam
objCmd.Parameters.Append objCmd.CreateParameter ("QuestionID",adNumeric,adParamOutput)
objCmd.Execute
This gives me an error "Invalid scale value"???
Anybody have any ideas?
1.
set rstQuestionText = server.CreateObject("ADODB.Recordset"
with rstQuestionText
.CursorLocation = adUseClient
.Open "imagecareinc.get_question_text_from_text('" & strQuestionText & "')", cnn,,,adCmdStoredProc
end with
Obviously, if there is a single quote within the strQuestionText variable, it bombs.
So I tried using the command object.
2.
dim objCmd, objParam
set objParam = server.CreateObject("ADODB.Parameter"
set objCmd = server.CreateObject("ADODB.Command"
objCmd.ActiveConnection = cnn
objCmd.CommandText = "imagecareinc.get_question_text_from_text"
objCmd.CommandType = adcmdstoredproc
objParam.Attributes = adFldLong
objParam.Name = "QuestionText"
objParam.Type = adLongVarWChar
objParam.Direction = adParamInput
objParam.Size = 16
objParam.value = strQuestionText
objCmd.Parameters.Append objParam
objCmd.Parameters.Append objCmd.CreateParameter ("QuestionID",adNumeric,adParamOutput)
objCmd.Execute
This gives me an error "Invalid scale value"???
Anybody have any ideas?