|
 |
access_asp thread: Newb needs help badly!
Message #1 by "Jon Harris" <music_survey@h...> on Sun, 3 Feb 2002 20:49:50
|
|
Hey all,
Got a problem and I'm sure it's probably been written a few hundred times
in the forum already. I'm new to ASP but familiar with other languages.
I'm tying to take form data from one page and send it to a process.asp
page. This page as it's titled is supposed to take the form data and
write it to my MS ACCESS database i have setup. Heres the rundown.
DSN name: partnernetwork
DB name: partnernetwork
Table name: partners
DB location d:\inetpub\dbroot\partnernetwor\partnernetwork.mdb
Page name of the form: index.asp
Page name of the process: process.asp
All i'm trying to do is take the form data and put it in the DB. Here is
what I have on my process.asp page. Don't laugh... like I said, I'm new
to this. The error I'm getting is posted below the code. Well here it is.
<%@ Language=VBScript %>
<!- - #include file="adovbs.inc" - ->
<%
Dim Connect, Constr, Record, company, firstname, lastname, address1, apt,
city, state, zip, phonearea, phonepre, phonesuf, email, category,
sell_products, more_info
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=D:\Inetpub\dbroot\partnernetwork\partnernetwork.mdb"
Connect.Open
Set Record = Server.CreateObject("ADODB.Recordset")
Record.Open "partners"
recordSet.AddNew
Record("company") = Request("company")
Record("firstname") = Request("firstname")
Record("lastname") = Request("lastname")
Record("address1") = Request("address1")
Record("apt") = Request("apt")
Record("city") = Request("city")
Record("state") = Request("state")
Record("zip") = Request("zip")
Record("phonearea") = Request("phonearea")
Record("phonepre") = Request("phonepre")
Record("phonesuf") = Request("phonesuf")
Record("email") = Request("email")
Record("category") = Request("category")
Record("sell_products") = Request("sellproducts")
Record("more_info") = Request("more_info")
recordSet.Update
connectionToDatabase.Close
Set connectionToDatabase=Nothing
%>
Error:
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
/process/process.asp, line 20
Any suggestions???
Thanks,
Jon
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 4 Feb 2002 10:12:51 +1100
|
|
www.adopenstatic.com/faq/800a0bb9.asp
should help you here. At the bottom of the page, read the stuff on the
required parameters of the Recordset's .Open method (you need to supply a
source, as well as a valid connection object or string)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jon Harris" <music_survey@h...>
Subject: [access_asp] Newb needs help badly!
: Hey all,
:
: Got a problem and I'm sure it's probably been written a few hundred times
: in the forum already. I'm new to ASP but familiar with other languages.
: I'm tying to take form data from one page and send it to a process.asp
: page. This page as it's titled is supposed to take the form data and
: write it to my MS ACCESS database i have setup. Heres the rundown.
:
: DSN name: partnernetwork
: DB name: partnernetwork
: Table name: partners
: DB location d:\inetpub\dbroot\partnernetwor\partnernetwork.mdb
: Page name of the form: index.asp
: Page name of the process: process.asp
:
: All i'm trying to do is take the form data and put it in the DB. Here is
: what I have on my process.asp page. Don't laugh... like I said, I'm new
: to this. The error I'm getting is posted below the code. Well here it is.
:
: <%@ Language=VBScript %>
: <!- - #include file="adovbs.inc" - ->
:
: <%
: Dim Connect, Constr, Record, company, firstname, lastname, address1, apt,
: city, state, zip, phonearea, phonepre, phonesuf, email, category,
: sell_products, more_info
:
: Set Connect = Server.CreateObject("ADODB.Connection")
:
: Connect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
: Source=D:\Inetpub\dbroot\partnernetwork\partnernetwork.mdb"
:
: Connect.Open
:
: Set Record = Server.CreateObject("ADODB.Recordset")
: Record.Open "partners"
:
: recordSet.AddNew
: Record("company") = Request("company")
: Record("firstname") = Request("firstname")
: Record("lastname") = Request("lastname")
: Record("address1") = Request("address1")
: Record("apt") = Request("apt")
: Record("city") = Request("city")
: Record("state") = Request("state")
: Record("zip") = Request("zip")
: Record("phonearea") = Request("phonearea")
: Record("phonepre") = Request("phonepre")
: Record("phonesuf") = Request("phonesuf")
: Record("email") = Request("email")
: Record("category") = Request("category")
: Record("sell_products") = Request("sellproducts")
: Record("more_info") = Request("more_info")
: recordSet.Update
:
: connectionToDatabase.Close
: Set connectionToDatabase=Nothing
: %>
:
: Error:
: ADODB.Recordset error '800a0bb9'
:
: Arguments are of the wrong type, are out of acceptable range, or are in
: conflict with one another.
:
: /process/process.asp, line 20
:
: Any suggestions???
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Steffen Wogensen Jaques" <webmaster@w...> on Mon, 4 Feb 2002 00:31:52 +0100
|
|
Try this instead:
<%
Dim Connect, strConnect, Constr, Record, company, firstname, lastname,
address1, apt,
city, state, zip, phonearea, phonepre, phonesuf, email, category,
sell_products, more_info
Set Connect = Server.CreateObject("ADODB.Connection")
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=D:\Inetpub\dbroot\partnernetwork\partnernetwork.mdb"
Connect.Open strConnect
Set Record = Server.CreateObject("ADODB.Recordset")
Record.Open "partners", Connect, adOpenDynamic, adLockOptimistic, adCmdTable
...
...
...
and so forth
----- Original Message -----
From: "Jon Harris" <music_survey@h...>
To: "Access ASP" <access_asp@p...>
Sent: Sunday, February 03, 2002 8:49 PM
Subject: [access_asp] Newb needs help badly!
> Hey all,
>
> Got a problem and I'm sure it's probably been written a few hundred times
> in the forum already. I'm new to ASP but familiar with other languages.
> I'm tying to take form data from one page and send it to a process.asp
> page. This page as it's titled is supposed to take the form data and
> write it to my MS ACCESS database i have setup. Heres the rundown.
>
> DSN name: partnernetwork
> DB name: partnernetwork
> Table name: partners
> DB location d:\inetpub\dbroot\partnernetwor\partnernetwork.mdb
> Page name of the form: index.asp
> Page name of the process: process.asp
>
> All i'm trying to do is take the form data and put it in the DB. Here is
> what I have on my process.asp page. Don't laugh... like I said, I'm new
> to this. The error I'm getting is posted below the code. Well here it is.
>
> <%@ Language=VBScript %>
> <!- - #include file="adovbs.inc" - ->
>
> <%
> Dim Connect, Constr, Record, company, firstname, lastname, address1, apt,
> city, state, zip, phonearea, phonepre, phonesuf, email, category,
> sell_products, more_info
>
> Set Connect = Server.CreateObject("ADODB.Connection")
>
> Connect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
> Source=D:\Inetpub\dbroot\partnernetwork\partnernetwork.mdb"
>
> Connect.Open
>
> Set Record = Server.CreateObject("ADODB.Recordset")
> Record.Open "partners"
>
> recordSet.AddNew
> Record("company") = Request("company")
> Record("firstname") = Request("firstname")
> Record("lastname") = Request("lastname")
> Record("address1") = Request("address1")
> Record("apt") = Request("apt")
> Record("city") = Request("city")
> Record("state") = Request("state")
> Record("zip") = Request("zip")
> Record("phonearea") = Request("phonearea")
> Record("phonepre") = Request("phonepre")
> Record("phonesuf") = Request("phonesuf")
> Record("email") = Request("email")
> Record("category") = Request("category")
> Record("sell_products") = Request("sellproducts")
> Record("more_info") = Request("more_info")
> recordSet.Update
>
> connectionToDatabase.Close
> Set connectionToDatabase=Nothing
> %>
>
> Error:
> ADODB.Recordset error '800a0bb9'
>
> Arguments are of the wrong type, are out of acceptable range, or are in
> conflict with one another.
>
> /process/process.asp, line 20
>
> Any suggestions???
>
> Thanks,
> Jon
>
$subst('Email.Unsub').
Message #4 by "Jon Harris" <music_survey@h...> on Mon, 4 Feb 2002 03:28:25
|
|
Thanks for the suggestions. I tried to visit that website but the site
appears to be down... I took the second response advice and now am
getting a new error... Here is the new code I have and then the new
error.
<%@ Language=VBScript %>
<!- - #include file="adovbs.inc" - ->
<%
Dim Connect, strConnect, Constr, Record, company, firstname, lastname,
address1, apt,
city, state, zip, phonearea, phonepre, phonesuf, email, category,
sell_products, more_info
Set Connect = Server.CreateObject("ADODB.Connection")
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=D:\Inetpub\dbroot\partnernetwork\partnernetwork.mdb"
Connect.Open strConnect
Set Record = Server.CreateObject("ADODB.Recordset")
Record.Open "partners", Connect, adOpenDynamic, adLockOptimistic,
adCmdTable
recordSet.AddNew
Record("company") = Request("company")
Record("firstname") = Request("firstname")
Record("lastname") = Request("lastname")
Record("address1") = Request("address1")
Record("apt") = Request("apt")
Record("city") = Request("city")
Record("state") = Request("state")
Record("zip") = Request("zip")
Record("phonearea") = Request("phonearea")
Record("phonepre") = Request("phonepre")
Record("phonesuf") = Request("phonesuf")
Record("email") = Request("email")
Record("category") = Request("category")
Record("sell_products") = Request("sellproducts")
Record("more_info") = Request("more_info")
recordSet.Update
connectionToDatabase.Close
Set connectionToDatabase=Nothing
%>
Here is the new error.
Microsoft VBScript compilation error '800a03f2'
Expected identifier
/process/process.asp, line 11
Dim Connect, strConnect, Constr, Record, company, firstname, lastname,
----------------------------------------------------------------------^
Thanks,
Jon
Message #5 by "Ken Schaefer" <ken@a...> on Mon, 4 Feb 2002 15:44:33 +1100
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jon Harris" <music_survey@h...>
Subject: [access_asp] Re: Newb needs help badly!
: Thanks for the suggestions. I tried to visit that website but the site
: appears to be down...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to heavy rain over here our microwave link to the outside world is a bit
flakey, and our fibre backup gets overloaded. The storms seem to have eased
off slightly, so you could try again.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: I took the second response advice and now am
: getting a new error... Here is the new code I have and then the new
: error.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: <%@ Language=VBScript %>
: <!- - #include file="adovbs.inc" - ->
Firstly, the way you are writing the #include directive is incorrect. It
should be:
<!-- #include file="adovbs.inc" -->
(ie there are *no* spaces between the two - at the beginning and end.
Secondly, the line:
: Dim Connect, strConnect, Constr, Record, company, firstname, lastname,
: address1, apt,
: city, state, zip, phonearea, phonepre, phonesuf, email, category,
: sell_products, more_info
should all be on a single line, not on separate lines. Alternatively, you
need to put a Dim at the beginning of each line where you are dimming
variables. My personal preference is however to DIM each variable on a new
line:
Dim strConnect ' as String, DB Connection string
Dim strSQL ' as String, SQL string
Dim objConn ' as ADODB.Connection object
etc
Cheers
Ken
Message #6 by "Jon Harris" <music_survey@h...> on Mon, 4 Feb 2002 06:15:16
|
|
Hey all,
Want to send an extra special thanks to Robert Griffin. He spent about
an hour with me tinkering with my code and we got it to work! Here is
the working code... Thanks a bunch Robert. :)
<%
Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
connectionToDatabase.ConnectionTimeout=40
connectionToDatabase.Open "DSN=partnernetwork"
strSQL = "INSERT INTO partners (" & _
"company, " & _
"firstname, " & _
"lastname, " & _
"address1, " & _
"apt, city, " & _
"state, " & _
"zip, " & _
"phonearea, " & _
"phonepre, " & _
"phonesuf, " & _
"email, " & _
"website, " & _
"category, " & _
"sell_products, " & _
"connection_type, " & _
"more_info " & _
") VALUES ('" & _
Request("company") & "', '" & _
Request("firstname") & "', '" & _
Request("lastname") & "', '" & _
Request("address1") & "', '" & _
Request("apt") & "', '" & _
Request("city") & "', '" & _
Request("state") & "', '" & _
Request("zip") & "', '" & _
Request("phonearea") & "', '" & _
Request("phonepre") & "', '" & _
Request("phonesuf") & "', '" & _
Request("email") & "', '" & _
Request("website") & "', '" & _
Request("category ")& "', " & _
Request("sell_products") & ", '" & _
Request("connection_type") & "', " & _
Request("more_info") & ")"
connectionToDatabase.Execute(strSQL)
connectionToDatabase.Close
Set connectionToDatabase=Nothing
%>
Message #7 by "Ganesh Danej" <gmdanej@h...> on Mon, 4 Feb 2002 06:38:26
|
|
Thank you,
Testing
> Hey all,
>
> Want to send an extra special thanks to Robert Griffin. He spent about
> an hour with me tinkering with my code and we got it to work! Here is
> the working code... Thanks a bunch Robert. :)
>
> <%
> Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
> connectionToDatabase.ConnectionTimeout=40
> connectionToDatabase.Open "DSN=partnernetwork"
>
> strSQL = "INSERT INTO partners (" & _
> "company, " & _
> "firstname, " & _
> "lastname, " & _
> "address1, " & _
> "apt, city, " & _
> "state, " & _
> "zip, " & _
> "phonearea, " & _
> "phonepre, " & _
> "phonesuf, " & _
> "email, " & _
> "website, " & _
> "category, " & _
> "sell_products, " & _
> "connection_type, " & _
> "more_info " & _
> ") VALUES ('" & _
> Request("company") & "', '" & _
> Request("firstname") & "', '" & _
> Request("lastname") & "', '" & _
> Request("address1") & "', '" & _
> Request("apt") & "', '" & _
> Request("city") & "', '" & _
> Request("state") & "', '" & _
> Request("zip") & "', '" & _
> Request("phonearea") & "', '" & _
> Request("phonepre") & "', '" & _
> Request("phonesuf") & "', '" & _
> Request("email") & "', '" & _
> Request("website") & "', '" & _
> Request("category ")& "', " & _
> Request("sell_products") & ", '" & _
> Request("connection_type") & "', " & _
> Request("more_info") & ")"
>
> connectionToDatabase.Execute(strSQL)
>
> connectionToDatabase.Close
>
> Set connectionToDatabase=Nothing
>
> %>
Message #8 by "Ganesh Danej" <gmdanej@h...> on Mon, 4 Feb 2002 07:17:30
|
|
Message #9 by "Ken Schaefer" <ken@a...> on Mon, 4 Feb 2002 18:18:31 +1100
|
|
Great that you got it working. I do have one more thing to add though:
*never* simply take what a user has entered into a form and try to stick it
into your database (or perform any other type of processing). It's too easy
to break your application, or worse...
http://www.adopenstatic.com/resources/code/UIValidation.asp is something I
wrote that might get you started.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jon Harris" <music_survey@h...>
Subject: [access_asp] Re: Newb needs help badly!
: Hey all,
:
: Want to send an extra special thanks to Robert Griffin. He spent about
: an hour with me tinkering with my code and we got it to work! Here is
: the working code... Thanks a bunch Robert. :)
:
: <%
: Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
: connectionToDatabase.ConnectionTimeout=40
: connectionToDatabase.Open "DSN=partnernetwork"
:
: strSQL = "INSERT INTO partners (" & _
: "company, " & _
: "firstname, " & _
: "lastname, " & _
: "address1, " & _
: "apt, city, " & _
: "state, " & _
: "zip, " & _
: "phonearea, " & _
: "phonepre, " & _
: "phonesuf, " & _
: "email, " & _
: "website, " & _
: "category, " & _
: "sell_products, " & _
: "connection_type, " & _
: "more_info " & _
: ") VALUES ('" & _
: Request("company") & "', '" & _
: Request("firstname") & "', '" & _
: Request("lastname") & "', '" & _
: Request("address1") & "', '" & _
: Request("apt") & "', '" & _
: Request("city") & "', '" & _
: Request("state") & "', '" & _
: Request("zip") & "', '" & _
: Request("phonearea") & "', '" & _
: Request("phonepre") & "', '" & _
: Request("phonesuf") & "', '" & _
: Request("email") & "', '" & _
: Request("website") & "', '" & _
: Request("category ")& "', " & _
: Request("sell_products") & ", '" & _
: Request("connection_type") & "', " & _
: Request("more_info") & ")"
:
: connectionToDatabase.Execute(strSQL)
:
: connectionToDatabase.Close
:
: Set connectionToDatabase=Nothing
:
: %>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |