PaulHInstincticve
Programmer
I am using a parameterised update command instead of an SQL command because I have long character fields captured in a form that I need to store to Visual FoxPro variable length memo fields that can exceed 255 characters which in turn will break the SQL command. This has been working fine if I have values in these notes fields but I now hit an error if the notes field being passed is empty. The error is
Parameter object is improperly defined. Inconsistent or incomplete information was provided
Do I need a different syntax in the createparameter method or am I simply restricted so that I must pass a value even if only a single space character (I would like to avoid that if possible to avoid adding unecessary data to the database)
dim cmd
Set cmd = Server.CreateObject( "ADODB.Command" )
cmd.ActiveConnection = con
cmd.CommandType = adCmdText
cmd.CommandText = "insert into mydatabase " &_
"(cref, mnotes1, mnotes2, mnotes3 " &_
"values "('00001', ?, ?, ?) "
set Param = cmd.CreateParameter("notes1", adLongVarChar, adParamInput, len(lcnotes1) , lcnotes1)
cmd.Parameters.Append(Param)
set Param = cmd.CreateParameter("notes2", adLongVarChar, adParamInput, len(lcnotes2) , lcnotes2)
cmd.Parameters.Append(Param)
set Param = cmd.CreateParameter("notes3", adLongVarChar, adParamInput, len(lcnotes3) , lcnotes3)
cmd.Parameters.Append(Param)
cmd.Execute()
set param = nothing
set cmd = nothing
Any help with the syntax required here will be gratefully received. Thanks
Paul
Parameter object is improperly defined. Inconsistent or incomplete information was provided
Do I need a different syntax in the createparameter method or am I simply restricted so that I must pass a value even if only a single space character (I would like to avoid that if possible to avoid adding unecessary data to the database)
dim cmd
Set cmd = Server.CreateObject( "ADODB.Command" )
cmd.ActiveConnection = con
cmd.CommandType = adCmdText
cmd.CommandText = "insert into mydatabase " &_
"(cref, mnotes1, mnotes2, mnotes3 " &_
"values "('00001', ?, ?, ?) "
set Param = cmd.CreateParameter("notes1", adLongVarChar, adParamInput, len(lcnotes1) , lcnotes1)
cmd.Parameters.Append(Param)
set Param = cmd.CreateParameter("notes2", adLongVarChar, adParamInput, len(lcnotes2) , lcnotes2)
cmd.Parameters.Append(Param)
set Param = cmd.CreateParameter("notes3", adLongVarChar, adParamInput, len(lcnotes3) , lcnotes3)
cmd.Parameters.Append(Param)
cmd.Execute()
set param = nothing
set cmd = nothing
Any help with the syntax required here will be gratefully received. Thanks
Paul