Experts: I am still attempting to add more than 255 characters to a memo field in Foxpro 6.0.
I am now getting the message above. Here is the entire inssert and update query code.
sub AddRecord
set insconn=server.CreateObjec
t("ADODB.C
onnection"
)
set insrs=server.CreateObject(
"ADODB.Rec
ordset")
insconn.Open "DSN=ifis"
InsQry="Insert into change_requestrev1 (track_no, subject, req_date, initiator, eff_date, req_desc, bus_value, progrun, progname, t_details, back_plan, risks, app_date, app_by, recommend, comp_date) values ("
InsQry=InsQry & "" & formatnumber(int(trim(Requ
est.Form("
strRecNo")
)),0,0,0,0
) & ",'"
InsQry=insQry & Replace(trim(Request.Form(
"subject")
), "'", "''") &"',"
InsQry=InsQry & "{^" & cstr(year(cdate(Request.Fo
rm("req_da
te")))) & "-" & cstr(month(cdate(Request.F
orm("req_d
ate")))) & "-" & cstr(day(cdate(Request.For
m "req_date")))) "},'"
InsQry=insQry & Replace(trim(Request.Form(
"initiator
")), "'", "''") & "',"
InsQry=InsQry & "{^" & cstr(year(cdate(Request.Fo
rm("eff_da
te")))) & "-" & cstr(month(cdate(Request.F
orm("eff_d
ate")))) & "-" & cstr(day(cdate(Request.For
m("eff_dat
e")))) "},'"
if Request.form("eff_date")="
" then
InsQry=InsQry & "CTOD('//'),'"
end if
**THIS WILL BREAK UP THE LONG STRING IF MORE THAN 200 CHARACTERS ARE ENTERED**
if len(Request.form("req_desc
"))>200 then
Workstring=mid(Request.for
m("req_des
c"), 201, len(Request.form("req_desc
")))
req_desc=Replace(Mid(Reque
st.Form("r
eq_desc"),
1, 200), "'", "''")
InsQry=insQry & Replace(Mid(Request.Form("
req_desc")
, 1, 200), "'", "''") & "','"
else
req_desc=Replace(Request.F
orm("req_d
esc"), "'", "''")
InsQry=insQry & Replace(trim(Request.Form(
"req_desc"
)), "'", "''") & "','"
end if
InsQry=insQry & Replace(trim(Request.Form(
"bus_value
")), "'", "''") & "',"
if Request.Form ("progrun")="True" then
InsQry=InsQry & ".T.,'"
end if
if Request.Form ("progrun")="False" then
InsQry=InsQry & ".F.,'"
end if
if Request.Form ("progrun")="" then
InsQry=InsQry & ".F.,'"
end if
InsQry=insQry & Replace(trim(Request.Form(
"progname"
)), "'", "''") & "','"
InsQry=insQry & Replace(trim(Request.Form(
"t_details
")), "'", "''") & "','"
InsQry=insQry & Replace(trim(Request.Form(
"back_plan
")), "'", "''") & "','"
InsQry=insQry & Replace(trim(Request.Form(
"risks")),
"'", "''") & "',"
InsQry=InsQry & "{^" & cstr(year(cdate(Request.Fo
rm("app_da
te")))) & "-" & cstr(month(cdate(Request.F
orm("app_d
ate")))) & "-" & cstr(day(cdate(Request.For
m("app_dat
e")))) &"},'"
if Request.form("app_date")="
" then
InsQry=InsQry & "CTOD('//'),'"
end if
InsQry=insQry & Replace(trim(Request.Form(
"app_by"))
, "'", "''") & "','"
InsQry=insQry & Replace(trim(Request.Form(
"recommend
")), "'", "''") &"',"
InsQry=InsQry & "{^" & cstr(year(cdate(Request.Fo
rm("comp_d
ate")))) & "-" & cstr(month(cdate(Request.F
orm("comp_
date")))) & "-" & cstr(day(cdate(Request.For
m("comp_da
te")))) &"})"
if Request.form("comp_date")=
"" then
InsQry=InsQry & "CTOD('//'))"
end if
Response.Write "<br>"
Insrs.open insconn.Execute(InsQry)
Response.Write insQry
Response.Write "<br>"
Response.Write "This is req_desc " & req_desc & "<br>"
Response.Write "The WorkString is " & WorkString
*** END OF INSERT ***
***UPDATE IF REQ_DESC IS LONGER THAN 200 CHARS ***
if WorkString<>"" then
set connA=server.CreateObject(
"ADODB.Con
nection")
set rsA=server.CreateObject("A
DODB.Recor
dset")
connA.Open "DSN=ifis"
if err then
response.Write err.Source
Response.Write err.Number
Response.Write err.Description
End if
sql4="Update change_requestrev1 set req_desc=" & "'" & req_desc + Workstring & "'"
sql4=sql4 & " where change_requestrev1.track_n
o=" & strTrackNo & ""
I have tried both these methods but still get the same error
'rsA.Open connA.Execute(sql4)
rsA.Open connA.Execute(sql4),,adOpe
nDynamic, adLockOptimistic
Response.Write sql4
end if
end sub
Any help would be greatly appreciated.