|
 |
asp_web_howto thread: mysql and insertion
Message #1 by nusrat sarwar <nusratsarwar@y...> on Wed, 8 May 2002 14:01:13 -0700 (PDT)
|
|
hi all hope you are well and fine
I need help regarding ASP and MYSQL
I did the connectivity
selected the data well successfully
but when I wanted form values to be inserted in the
database it didnt work
all fields are varchar no primary key no indexing
all fields are not null
here is the code help meout please I am stuck badly
<%@ LANGUAGE = 'VBSCRIPT'%>
<%
response.buffer = true
On Error Resume Next
dim strConnection
dim adoConn
dim adoRS
dim strconn
dim dbcon
dim rs
dim rs2
dim str
dim str1
dim str2
dim str3
dim str4
dim str5
dim str6
dim str7
dim str8
dim str9
dim str10
dim str11
dim str12
dim str13
dim str14
dim str15
dim str16
dim str17
dim str18
dim str19
str1=Request.Form("fp")
str2=Request.Form("FirstName")
str3=Request.Form("LastName")
str4=Request.Form("phone")
str5=Request.Form("Fax")
str6=Request.Form("email")
str7=Request.Form("Company")
str8=Request.Form("address")
str9=Request.Form("city")
str10=Request.Form("state")
str11=Request.Form("ZIP")
str12=Request.Form("country")
str13=Request.Form("PaymentType")
str14=Request.Form("check_nbr")
str15=Request.Form("cardNumber")
str16=Request.Form("ExpMonth")
str17=Request.Form("ExpYear")
str18=Request.Form("holder")
str19=Request.Form("source")
str20=Request.Form("sponsor")
strConnection
"driver={MySQL};server=localhost;uid=user;pwd=mypwd;database=mysqldb;option=NUM"
Set adoConn = Server.CreateObject("ADODB.Connection")
adoConn.Open strConnection
strQuery = "INSERT INTO `order` (product, fname,
lname, phone, fax, email, company, address, city,
state, zip, country, paymentType, chknum, creditcard,
expMonth, expYear, chname, howfind, sponsor) VALUES
('"&str1&"','"&str2&"','"&str3&"','"&str4&"','"&str5&"','"&str6&"','"&str7&"
','"&str8&"','"&str9&"','"&str10&"','"&str11&"','"&str12&"','"&str13&"','"&str14
&"','"&str15&"','"&str16&"','"&str17&"','"&str18&"','"&str19&"','"&str20&"');
"
Set adoRS = adoConn.Execute(strQuery)
Session("allow") = True
adoRS.close
set adoRS= nothing
adoConn.close
set adoConn = nothing
Response.Redirect"../order.htm"
%>
take care
regards
nusrat
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
Message #2 by Joe Ingle <Joe@k...> on Thu, 9 May 2002 08:31:12 +0100
|
|
Hi Nusrat
I'm no mySQL authority, but from an ASP perspective, your trying to use a
recordset object to insert your data.
Instead of using:
Set adoRS = adoConn.Execute(strQuery)
use:
adoConn.Execute strQuery
and you could also loose:
adoRS.close
set adoRS= nothing
as you haven't created a recordset. Also , you can change `order` to just
order, and that should work for you.
Joe
-----Original Message-----
From: nusrat sarwar [mailto:nusratsarwar@y...]
Sent: 08 May 2002 22:01
To: ASP Web HowTo
Subject: [asp_web_howto] mysql and insertion
hi all hope you are well and fine
I need help regarding ASP and MYSQL
I did the connectivity
selected the data well successfully
but when I wanted form values to be inserted in the
database it didnt work
all fields are varchar no primary key no indexing
all fields are not null
here is the code help meout please I am stuck badly
<%@ LANGUAGE = 'VBSCRIPT'%>
<%
response.buffer = true
On Error Resume Next
dim strConnection
dim adoConn
dim adoRS
dim strconn
dim dbcon
dim rs
dim rs2
dim str
dim str1
dim str2
dim str3
dim str4
dim str5
dim str6
dim str7
dim str8
dim str9
dim str10
dim str11
dim str12
dim str13
dim str14
dim str15
dim str16
dim str17
dim str18
dim str19
str1=Request.Form("fp")
str2=Request.Form("FirstName")
str3=Request.Form("LastName")
str4=Request.Form("phone")
str5=Request.Form("Fax")
str6=Request.Form("email")
str7=Request.Form("Company")
str8=Request.Form("address")
str9=Request.Form("city")
str10=Request.Form("state")
str11=Request.Form("ZIP")
str12=Request.Form("country")
str13=Request.Form("PaymentType")
str14=Request.Form("check_nbr")
str15=Request.Form("cardNumber")
str16=Request.Form("ExpMonth")
str17=Request.Form("ExpYear")
str18=Request.Form("holder")
str19=Request.Form("source")
str20=Request.Form("sponsor")
strConnection
"driver={MySQL};server=localhost;uid=user;pwd=mypwd;database=mysqldb;option
NUM"
Set adoConn = Server.CreateObject("ADODB.Connection")
adoConn.Open strConnection
strQuery = "INSERT INTO `order` (product, fname,
lname, phone, fax, email, company, address, city,
state, zip, country, paymentType, chknum, creditcard,
expMonth, expYear, chname, howfind, sponsor) VALUES
('"&str1&"','"&str2&"','"&str3&"','"&str4&"','"&str5&"','"&str6&"','"&str7&"
','"&str8&"','"&str9&"','"&str10&"','"&str11&"','"&str12&"','"&str13&"','"&s
tr14&"','"&str15&"','"&str16&"','"&str17&"','"&str18&"','"&str19&"','"&str20
&"');
"
Set adoRS = adoConn.Execute(strQuery)
Session("allow") = True
adoRS.close
set adoRS= nothing
adoConn.close
set adoConn = nothing
Response.Redirect"../order.htm"
%>
take care
regards
nusrat
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #3 by nusrat sarwar <nusratsarwar@y...> on Thu, 9 May 2002 07:18:59 -0700 (PDT)
|
|
Hi Joe
how can I thank you
I will try yr suggestion
May God give me success as its killing me(the problem)
God bless you as well
take care
regards
nusrat
--- Joe Ingle <Joe@k...> wrote:
> Hi Nusrat
>
> I'm no mySQL authority, but from an ASP perspective,
> your trying to use a
> recordset object to insert your data.
>
> Instead of using:
>
> Set adoRS = adoConn.Execute(strQuery)
>
> use:
>
> adoConn.Execute strQuery
>
> and you could also loose:
>
> adoRS.close
> set adoRS= nothing
>
> as you haven't created a recordset. Also , you can
> change `order` to just
> order, and that should work for you.
>
> Joe
>
>
>
> -----Original Message-----
> From: nusrat sarwar [mailto:nusratsarwar@y...]
> Sent: 08 May 2002 22:01
> To: ASP Web HowTo
> Subject: [asp_web_howto] mysql and insertion
>
>
>
> hi all hope you are well and fine
> I need help regarding ASP and MYSQL
>
> I did the connectivity
> selected the data well successfully
> but when I wanted form values to be inserted in the
> database it didnt work
>
> all fields are varchar no primary key no indexing
>
> all fields are not null
> here is the code help meout please I am stuck badly
>
>
> <%@ LANGUAGE = 'VBSCRIPT'%>
> <%
> response.buffer = true
> On Error Resume Next
> dim strConnection
> dim adoConn
> dim adoRS
> dim strconn
> dim dbcon
> dim rs
> dim rs2
> dim str
> dim str1
> dim str2
> dim str3
> dim str4
> dim str5
> dim str6
> dim str7
> dim str8
> dim str9
> dim str10
> dim str11
> dim str12
> dim str13
> dim str14
> dim str15
> dim str16
> dim str17
> dim str18
> dim str19
>
> str1=Request.Form("fp")
> str2=Request.Form("FirstName")
> str3=Request.Form("LastName")
> str4=Request.Form("phone")
> str5=Request.Form("Fax")
> str6=Request.Form("email")
> str7=Request.Form("Company")
> str8=Request.Form("address")
> str9=Request.Form("city")
> str10=Request.Form("state")
> str11=Request.Form("ZIP")
> str12=Request.Form("country")
> str13=Request.Form("PaymentType")
> str14=Request.Form("check_nbr")
> str15=Request.Form("cardNumber")
> str16=Request.Form("ExpMonth")
> str17=Request.Form("ExpYear")
> str18=Request.Form("holder")
> str19=Request.Form("source")
> str20=Request.Form("sponsor")
>
> strConnection
>
"driver={MySQL};server=localhost;uid=user;pwd=mypwd;database=mysqldb;option
> NUM"
> Set adoConn
> Server.CreateObject("ADODB.Connection")
> adoConn.Open strConnection
>
> strQuery = "INSERT INTO `order` (product, fname,
> lname, phone, fax, email, company, address, city,
> state, zip, country, paymentType, chknum,
> creditcard,
> expMonth, expYear, chname, howfind, sponsor) VALUES
>
('"&str1&"','"&str2&"','"&str3&"','"&str4&"','"&str5&"','"&str6&"','"&str7&"
>
','"&str8&"','"&str9&"','"&str10&"','"&str11&"','"&str12&"','"&str13&"','"&s
>
tr14&"','"&str15&"','"&str16&"','"&str17&"','"&str18&"','"&str19&"','"&str20
> &"');
> "
> Set adoRS = adoConn.Execute(strQuery)
>
>
> Session("allow") = True
>
> adoRS.close
> set adoRS= nothing
> adoConn.close
> set adoConn = nothing
> Response.Redirect"../order.htm"
> %>
> take care
> regards
> nusrat
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
>
> ---
>
> Improve your web design skills with these new books
> from Glasshaus.
>
> Usable Web Menus
>
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
>
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
>
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
>
>
> ---
>
> Improve your web design skills with these new books
> from Glasshaus.
>
> Usable Web Menus
>
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
>
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
>
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com
|
|
 |