asp_databases thread: urgent help wanted with this page!please!
Message #1 by "Eric Van Camp" <eric.vancamp@c...> on Thu, 30 Nov 2000 01:05:13 -0000
|
|
i have this string , which if i put it in sql query tool it is executed:
'response.write "request.formcoyid="&request.form("coyid")
'response.write "typeid="&request.form'"typeid")
strSQL = _
"INSERT INTO bforms (coyid,typeid,papertype, addressid, tel, fax, btw, hr
,b1 ,b2 ,b3 ,b4 ,description ,paper ,printcolors ,col1 ,col2 ,col3 ,col4
,col5,actif) VALUES ('"& request.form("coyId") &
"','"&request.form("bformid")&"','" & request.form("typeid") & "',"&
request.form("addressid") & ",'" & strtel & "','" & strfax & "','"& strbtw
&"','"& strhr & "','"& strb1 &"','"& strb2 &"','"& strb3 &"','"& strb4
&"','"& request.form("description")&"','"& request.form("paper")&"','"&
request.form("printcolors")&"','"& request.form("col1")&"','"&
request.form("col2")&"','"& request.form("col3")&"','"&
request.form("col4")&"','"& request.form("col5")&"',"&stractif&")"
****************************************************************************
***
apparantly all the fields are known and the information types are correct..
the page on which i have this string
<% response.buffer = true %>
<!--#include virtual="includes/adovbs.inc" -->
<!--#include virtual="includes/tools_ameel.inc"-->
<html>
<head>
<title><%=storename%> Maintenance</title>
<!--#include virtual="includes/sysadmin.inc"-->
<%
rem create a sso to provide link to the database
set conn = Server.CreateObject("ADODB.Connection")
rem set connect info
conn.Connectionstring = "DSN=" & application("OdbcConname") & ";UID=" &
application("OdbcUsername") & ";PWD=" & application("OdbcPassword")
rem open the connection
conn.open
set rsaddress=server.createObject("ADODB.Recordset")
sql= "select * from addresses where addressid="&request.form("addressid")
response.write sql
rsaddress.open sql,conn, , ,Adcmdtext
while not rsaddress.eof
strtel=rsaddress("tel")
strfax=rsaddress("fax")
strbtw=rsaddress("btw")
strhr=rsaddress("hr")
strb1=rsaddress("b1")
response.write "strb1="&strb1
strb2=rsaddress("b2")
strb3=rsaddress("b3")
strb4=rsaddress("b4")
stremail=rsaddress("email")
rsaddress.movenext
wend
rsaddress.close
set rsaddress=nothing
%>
</head>
<body text="#FFFFFF" link="#0000A0" vlink="#0000A0" alink="#0000A0"
bgcolor="#FFFFFF">
<%
temp1 = request.form("qsi")
'response.write"temp1="&temp1&"<br>"
'response.write"typeid="&request.form("typeid")
rem Create a command
' HERE YOU CAN HAVE ERROR HANDLER
ON ERROR RESUME NEXT
set adoCommand = Server.CreateObject("ADODB.Command")
adoCommand.CommandType = adCmdText
adoCommand.ActiveConnection = conn
rem Constuct your sql query
if temp1 = "Yes" then
stractif = -1
else
stractif = 0
end if
temp4=request.form("telbox")
if temp4<>"on" then strtel=""
temp5=request.form("faxbox")
if temp5<>"on" then strfax=""
temp6=request.form("btw")
if temp6<>"on" then strbtw=""
temp7=request.form("hr")
if temp7<>"on" then strhr=""
temp8=request.form("b1")
if temp8<>"on" then strb1=""
temp9=request.form("b2")
if temp9<>"on" then strb3=""
temp10=request.form("b4")
if temp10<>"on" then strb4=""
'response.write "request.formcoyid="&request.form("coyid")
'response.write "typeid="&request.form'"typeid")
strSQL = _
"INSERT INTO bforms (coyid,typeid,papertype, addressid, tel, fax, btw, hr
,b1 ,b2 ,b3 ,b4 ,description ,paper ,printcolors ,col1 ,col2 ,col3 ,col4
,col5,actif) VALUES ('"& request.form("coyId") &
"','"&request.form("bformid")&"','" & request.form("typeid") & "',"&
request.form("addressid") & ",'" & strtel & "','" & strfax & "','"& strbtw
&"','"& strhr & "','"& strb1 &"','"& strb2 &"','"& strb3 &"','"& strb4
&"','"& request.form("description")&"','"& request.form("paper")&"','"&
request.form("printcolors")&"','"& request.form("col1")&"','"&
request.form("col2")&"','"& request.form("col3")&"','"&
request.form("col4")&"','"& request.form("col5")&"',"&stractif&")"
adoCommand.Execute
if ERR.NUMBER <> 0 then
%>
<BR>There must be an error</BR>
<%
else
%>
<BR>INSERT OK</BR>
<%
end if
' RELEASE RESSOURCES
conn.close
set adoCommand = nothing
set conn = nothing
' response.redirect "index.asp?sessionid="&sessionid
%>
</body>
</html>
*********************************************
why do i get an error on this page..
as i detect the errors myself the ado.command.execute apparantly is not well
executed!
help help help help help
Message #2 by Imar Spaanjaars <Imar@S...> on Thu, 30 Nov 2000 08:35:01 +0100
|
|
Erik,
Can you turn of HTML mail / formatted mail?? All I get is white text on a
white background, which makes your posts rather hard to read and answer.
Imar
At 07:30 AM 11/30/2000 -0800, you wrote:
>i have this string , which if i put it in sql query tool it is executed:
>'response.write "request.formcoyid="&request.form("coyid")
>'response.write "typeid="&request.form'"typeid")
>strSQL = _
> "INSERT INTO bforms (coyid,typeid,papertype, addressid, tel, fax,
> btw, hr
>,b1 ,b2 ,b3 ,b4 ,description ,paper ,printcolors ,col1 ,col2 ,col3 ,col4
>,col5,actif) VALUES ('"& request.form("coyId") &
>"','"&request.form("bformid")&"','" & request.form("typeid") & "',"&
>request.form("addressid") & ",'" & strtel & "','" & strfax & "','"& strbtw
>&"','"& strhr & "','"& strb1 &"','"& strb2 &"','"& strb3 &"','"& strb4
>&"','"& request.form("description")&"','"& request.form("paper")&"','"&
>request.form("printcolors")&"','"& request.form("col1")&"','"&
>request.form("col2")&"','"& request.form("col3")&"','"&
>request.form("col4")&"','"& request.form("col5")&"',"&stractif&")"
>****************************************************************************
>***
>apparantly all the fields are known and the information types are correct..
>the page on which i have this string
><% response.buffer = true %>
><!--#include virtual="includes/adovbs.inc" -->
><!--#include virtual="includes/tools_ameel.inc"-->
>< <% rem create a sso to provide link to the database set conn =
>Server.CreateObject("ADODB.Connection") rem set connect info
>conn.Connectionstring = "DSN=" & application("OdbcConname") UID=" &
>
>application("OdbcUsername") PWD=" & application("OdbcPassword")
>rem open the connection conn.open set
>rsaddress=server.createObject("ADODB.Recordset") sql= "select * from
>addresses where addressid="&request.form("addressid")
>response.write sql rsaddress.open sql,conn, , ,Adcmdtext while not
>rsaddress.eof strtel=rsaddress("tel") strfax=rsaddress("fax")
>strbtw=rsaddress("btw") strhr=rsaddress("hr") strb1=rsaddress("b1")
>response.write "strb1="&strb1
>strb2=rsaddress("b2") strb3=rsaddress("b3") strb4=rsaddress("b4")
>stremail=rsaddress("email") rsaddress.movenext wend rsaddress.close set
>rsaddress=nothing %> <% temp1 = request.form("qsi")
>'response.write"temp1="&temp1&"
>" 'response.write"typeid="&request.form("typeid")
>rem Create a command ' HERE YOU CAN HAVE ERROR HANDLER ON ERROR RESUME
>NEXT set adoCommand = Server.CreateObject("ADODB.Command")
>adoCommand.CommandType = adCmdText adoCommand.ActiveConnection = conn rem
>Constuct your sql query if temp1 = "Yes" then stractif = -1 else stractif
>= 0 end if temp4=request.form("telbox") if temp4<>"on" then strtel=""
>temp5=request.form("faxbox") if temp5<>"on" then strfax=""
>temp6=request.form("btw") if temp6<>"on" then strbtw=""
>temp7=request.form("hr") if temp7<>"on" then strhr=""
>temp8=request.form("b1") if temp8<>"on" then strb1=""
>temp9=request.form("b2") if temp9<>"on" then strb3=""
>temp10=request.form("b4") if temp10<>"on" then strb4="" 'response.write
>"request.formcoyid="&request.form("coyid")
>'response.write "typeid="&request.form'"typeid")
>strSQL = _ "INSERT INTO bforms (coyid,typeid,papertype, addressid, tel,
>fax, btw, hr ,b1 ,b2 ,b3 ,b4 ,description ,paper ,printcolors ,col1 ,col2
>,col3 ,col4 ,col5,actif) VALUES ('"& request.form("coyId") &
>
>"','"&request.form("bformid")&"','" & request.form("typeid") & "',"&
>request.form("addressid") & ",'" & strtel & "','" & strfax & "','"& strbtw
>&"','"& strhr & "','"& strb1 &"','"& strb2 &"','"& strb3 &"','"& strb4
>&"','"& request.form("description")&"','"& request.form("paper")&"','"&
>request.form("printcolors")&"','"& request.form("col1")&"','"&
>request.form("col2")&"','"& request.form("col3")&"','"&
>request.form("col4")&"','"& request.form("col5")&"',"&stractif&")"
>adoCommand.Execute if ERR.NUMBER <> 0 then %>
>There must be an error <% else %>
>INSERT OK <% end if ' RELEASE RESSOURCES conn.close set adoCommand =
>nothing set conn = nothing 'response.redirect "index.asp?sessionid="&sessionid
>%> >
>
>*********************************************
>why do i get an error on this page..
>as i detect the errors myself the ado.command.execute apparantly is not well
>executed!
>help help help help help
Message #3 by "Ken Schaefer" <ken@a...> on Thu, 30 Nov 2000 22:41:05 +1100
|
|
Eric,
You say you get errors - but what is the error, and where is it occurring.
I assume that it is with the SQL statement. I suggest that you:
Response.Write(strSQL)
and post the output to the list.
Cheers
Ken
----- Original Message -----
From: "Eric Van Camp" <eric.vancamp@c...>
To: "ASP Databases" <asp_databases@p...>
Sent: Friday, December 01, 2000 2:30 AM
Subject: [asp_databases] urgent help wanted with this page!please!
> i have this string , which if i put it in sql query tool it is executed:
> 'response.write "request.formcoyid="&request.form("coyid")
> 'response.write "typeid="&request.form'"typeid")
> strSQL = _
> "INSERT INTO bforms (coyid,typeid,papertype, addressid, tel, fax, btw, hr
> ,b1 ,b2 ,b3 ,b4 ,description ,paper ,printcolors ,col1 ,col2 ,col3 ,col4
> ,col5,actif) VALUES ('"& request.form("coyId") &
> "','"&request.form("bformid")&"','" & request.form("typeid") & "',"&
> request.form("addressid") & ",'" & strtel & "','" & strfax & "','"& strbtw
> &"','"& strhr & "','"& strb1 &"','"& strb2 &"','"& strb3 &"','"& strb4
> &"','"& request.form("description")&"','"& request.form("paper")&"','"&
> request.form("printcolors")&"','"& request.form("col1")&"','"&
> request.form("col2")&"','"& request.form("col3")&"','"&
> request.form("col4")&"','"& request.form("col5")&"',"&stractif&")"
>
****************************************************************************
> ***
> apparantly all the fields are known and the information types are
correct..
> the page on which i have this string
> <% response.buffer = true %>
> <!--#include virtual="includes/adovbs.inc" -->
> <!--#include virtual="includes/tools_ameel.inc"-->
> <html>
> <head>
> <title><%=storename%> Maintenance</title>
> <!--#include virtual="includes/sysadmin.inc"-->
> <%
>
> rem create a sso to provide link to the database
> set conn = Server.CreateObject("ADODB.Connection")
>
> rem set connect info
> conn.Connectionstring = "DSN=" & application("OdbcConname") & ";UID=" &
> application("OdbcUsername") & ";PWD=" & application("OdbcPassword")
>
> rem open the connection
> conn.open
> set rsaddress=server.createObject("ADODB.Recordset")
> sql= "select * from addresses where addressid="&request.form("addressid")
> response.write sql
> rsaddress.open sql,conn, , ,Adcmdtext
> while not rsaddress.eof
> strtel=rsaddress("tel")
> strfax=rsaddress("fax")
> strbtw=rsaddress("btw")
> strhr=rsaddress("hr")
> strb1=rsaddress("b1")
> response.write "strb1="&strb1
> strb2=rsaddress("b2")
> strb3=rsaddress("b3")
> strb4=rsaddress("b4")
> stremail=rsaddress("email")
> rsaddress.movenext
> wend
> rsaddress.close
> set rsaddress=nothing
>
> %>
> </head>
> <body text="#FFFFFF" link="#0000A0" vlink="#0000A0" alink="#0000A0"
> bgcolor="#FFFFFF">
> <%
> temp1 = request.form("qsi")
> 'response.write"temp1="&temp1&"<br>"
> 'response.write"typeid="&request.form("typeid")
> rem Create a command
>
> ' HERE YOU CAN HAVE ERROR HANDLER
> ON ERROR RESUME NEXT
>
> set adoCommand = Server.CreateObject("ADODB.Command")
> adoCommand.CommandType = adCmdText
> adoCommand.ActiveConnection = conn
>
> rem Constuct your sql query
> if temp1 = "Yes" then
> stractif = -1
> else
> stractif = 0
> end if
>
> temp4=request.form("telbox")
> if temp4<>"on" then strtel=""
> temp5=request.form("faxbox")
> if temp5<>"on" then strfax=""
> temp6=request.form("btw")
> if temp6<>"on" then strbtw=""
> temp7=request.form("hr")
> if temp7<>"on" then strhr=""
> temp8=request.form("b1")
> if temp8<>"on" then strb1=""
> temp9=request.form("b2")
> if temp9<>"on" then strb3=""
> temp10=request.form("b4")
> if temp10<>"on" then strb4=""
>
>
> 'response.write "request.formcoyid="&request.form("coyid")
> 'response.write "typeid="&request.form'"typeid")
> strSQL = _
> "INSERT INTO bforms (coyid,typeid,papertype, addressid, tel, fax, btw, hr
> ,b1 ,b2 ,b3 ,b4 ,description ,paper ,printcolors ,col1 ,col2 ,col3 ,col4
> ,col5,actif) VALUES ('"& request.form("coyId") &
> "','"&request.form("bformid")&"','" & request.form("typeid") & "',"&
> request.form("addressid") & ",'" & strtel & "','" & strfax & "','"& strbtw
> &"','"& strhr & "','"& strb1 &"','"& strb2 &"','"& strb3 &"','"& strb4
> &"','"& request.form("description")&"','"& request.form("paper")&"','"&
> request.form("printcolors")&"','"& request.form("col1")&"','"&
> request.form("col2")&"','"& request.form("col3")&"','"&
> request.form("col4")&"','"& request.form("col5")&"',"&stractif&")"
>
>
> adoCommand.Execute
> if ERR.NUMBER <> 0 then
> %>
> <BR>There must be an error</BR>
> <%
>
> else
> %>
> <BR>INSERT OK</BR>
> <%
> end if
>
> ' RELEASE RESSOURCES
> conn.close
> set adoCommand = nothing
> set conn = nothing
>
>
> ' response.redirect "index.asp?sessionid="&sessionid
>
>
> %>
>
>
> <BR>
>
> </BODY>
> </html>
>
> *********************************************
> why do i get an error on this page..
> as i detect the errors myself the ado.command.execute apparantly is not
well
> executed!
> help help help help help
>
>
Message #4 by "Li, Fang" <fang@c...> on Thu, 30 Nov 2000 17:01:19 -0500
|
|
How about try:
& CStr(Request.form("somevariable")) & ..
Fang
-----Original Message-----
From: Eric Van Camp [mailto:eric.vancamp@c...]
Sent: Thursday, November 30, 2000 10:31 AM
To: ASP Databases
Subject: [asp_databases] urgent help wanted with this page!please!
i have this string , which if i put it in sql query tool it is executed:
'response.write "request.formcoyid="&request.form("coyid")
'response.write "typeid="&request.form'"typeid")
strSQL = _
"INSERT INTO bforms (coyid,typeid,papertype, addressid, tel, fax,
btw, hr
,b1 ,b2 ,b3 ,b4 ,description ,paper ,printcolors ,col1 ,col2 ,col3 ,col4
,col5,actif) VALUES ('"& request.form("coyId") &
"','"&request.form("bformid")&"','" & request.form("typeid") & "',"&
request.form("addressid") & ",'" & strtel & "','" & strfax & "','"& strbtw
&"','"& strhr & "','"& strb1 &"','"& strb2 &"','"& strb3 &"','"& strb4
&"','"& request.form("description")&"','"& request.form("paper")&"','"&
request.form("printcolors")&"','"& request.form("col1")&"','"&
request.form("col2")&"','"& request.form("col3")&"','"&
request.form("col4")&"','"& request.form("col5")&"',"&stractif&")"
****************************************************************************
***
apparantly all the fields are known and the information types are correct..
the page on which i have this string
<% response.buffer = true %>
<!--#include virtual="includes/adovbs.inc" -->
<!--#include virtual="includes/tools_ameel.inc"-->
<html>
<head>
<title><%=storename%> Maintenance</title>
<!--#include virtual="includes/sysadmin.inc"-->
<%
rem create a sso to provide link to the database
set conn = Server.CreateObject("ADODB.Connection")
rem set connect info
conn.Connectionstring = "DSN=" & application("OdbcConname") & ";UID=" &
application("OdbcUsername") & ";PWD=" & application("OdbcPassword")
rem open the connection
conn.open
set rsaddress=server.createObject("ADODB.Recordset")
sql= "select * from addresses where addressid="&request.form("addressid")
response.write sql
rsaddress.open sql,conn, , ,Adcmdtext
while not rsaddress.eof
strtel=rsaddress("tel")
strfax=rsaddress("fax")
strbtw=rsaddress("btw")
strhr=rsaddress("hr")
strb1=rsaddress("b1")
response.write "strb1="&strb1
strb2=rsaddress("b2")
strb3=rsaddress("b3")
strb4=rsaddress("b4")
stremail=rsaddress("email")
rsaddress.movenext
wend
rsaddress.close
set rsaddress=nothing
%>
</head>
<body text="#FFFFFF" link="#0000A0" vlink="#0000A0" alink="#0000A0"
bgcolor="#FFFFFF">
<%
temp1 = request.form("qsi")
'response.write"temp1="&temp1&"<br>"
'response.write"typeid="&request.form("typeid")
rem Create a command
' HERE YOU CAN HAVE ERROR HANDLER
ON ERROR RESUME NEXT
set adoCommand = Server.CreateObject("ADODB.Command")
adoCommand.CommandType = adCmdText
adoCommand.ActiveConnection = conn
rem Constuct your sql query
if temp1 = "Yes" then
stractif = -1
else
stractif = 0
end if
temp4=request.form("telbox")
if temp4<>"on" then strtel=""
temp5=request.form("faxbox")
if temp5<>"on" then strfax=""
temp6=request.form("btw")
if temp6<>"on" then strbtw=""
temp7=request.form("hr")
if temp7<>"on" then strhr=""
temp8=request.form("b1")
if temp8<>"on" then strb1=""
temp9=request.form("b2")
if temp9<>"on" then strb3=""
temp10=request.form("b4")
if temp10<>"on" then strb4=""
'response.write "request.formcoyid="&request.form("coyid")
'response.write "typeid="&request.form'"typeid")
strSQL = _
"INSERT INTO bforms (coyid,typeid,papertype, addressid, tel, fax,
btw, hr
,b1 ,b2 ,b3 ,b4 ,description ,paper ,printcolors ,col1 ,col2 ,col3 ,col4
,col5,actif) VALUES ('"& request.form("coyId") &
"','"&request.form("bformid")&"','" & request.form("typeid") & "',"&
request.form("addressid") & ",'" & strtel & "','" & strfax & "','"& strbtw
&"','"& strhr & "','"& strb1 &"','"& strb2 &"','"& strb3 &"','"& strb4
&"','"& request.form("description")&"','"& request.form("paper")&"','"&
request.form("printcolors")&"','"& request.form("col1")&"','"&
request.form("col2")&"','"& request.form("col3")&"','"&
request.form("col4")&"','"& request.form("col5")&"',"&stractif&")"
adoCommand.Execute
if ERR.NUMBER <> 0 then
%>
<BR>There must be an error</BR>
<%
else
%>
<BR>INSERT OK</BR>
<%
end if
' RELEASE RESSOURCES
conn.close
set adoCommand = nothing
set conn = nothing
' response.redirect "index.asp?sessionid="&sessionid
%>
</BODY>
</html>
*********************************************
why do i get an error on this page..
as i detect the errors myself the ado.command.execute apparantly is not well
executed!
help help help help help
|