|
 |
asp_databases thread: RE: sql statement
Message #1 by arshad siddiqui <ash_arshad@y...> on Thu, 2 May 2002 02:04:34 -0700 (PDT)
|
|
Hi all,
Thanks for your suggestions.
its working now there was a silly mistake in the
script thats why it was not giving any error and also
not submitting into the database.
Any ways thanks for your prompt response.
Best regards
--Arshad--
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
Message #2 by Aftab Ahmad <aftab.ahmad@k...> on Thu, 2 May 2002 09:18:58 +0200
|
|
Can we use where clause in insert statement? I think not.
Aftab
-----Original Message-----
From: arshad siddiqui [mailto:ash_arshad@y...]
Sent: 1. mai 2002 15:58
To: ASP Databases
Subject: [asp_databases] sql statement
Hi,
Please somebody tell me what sql statement shall I use
if I want to insert in few of the columns.
For example suppose I have a table in which I have
four columns i.e toneid,tonename,country,singer
toneid and tonename are filled but country and singer
are empty.I am using the following code but when I run
the script,there is no change in the database and also
no error is coming.
My code:
<%
dim toneid,singer,country
toneid=Request("toneid")
singer=Request("singer")
country=Request("country")
set cn=server.createobject("ADODB.Connection")
cn.Open "DBQ=" & Server.Mappath("satalcity2.mdb") &
";Driver={Microsoft Access Driver (*.mdb)};"
sql="insert into tbl_tones_master1(singer,country)
values ('"&singer&"','"&country&"') where
tone_id='"&toneid&"'"
cn.Execute sql
cn.Close
%>
<HTML><HEAD></head>
<BODY>
<P align=center><STRONG><FONT size=4>Singer and
country
Upload</FONT></STRONG></P>
<form method="post" action="uploadsinger.asp">
<P align=center><STRONG><FONT
size=4></FONT></STRONG> </P>
<P align=center><STRONG><FONT size=4>Tone_id
</FONT></STRONG><input type=toneid name=text1></P>
<P align=center><STRONG><FONT
size=4>Singer</FONT></STRONG><input type=singer
name=text2></P>
<P align=center><STRONG><FONT
size=4>Country</FONT></STRONG><input type=country
name=text3></P>
<P align=center><input type="submit" value="Upload"
name="B1"></p></form>
</BODY></HTML>
Please help
Thank You
Best regards
--Arshad--
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
Message #3 by "Drew, Ron" <RDrew@B...> on Wed, 1 May 2002 12:03:01 -0400
|
|
The insert is on the server the form is on the client. It does the
server stuff first before the client. If the form and insert is in the
same asp, you need to test for the client stuff first before you run the
server stuff.
Add a hidden field on your form like....
<input type=3D"hidden" name=3D"SubmitValue" value=3D"0">
Add an onSubmit to your form statement like....
onSubmit=3D"javascript:this.SubmitValue.value=3D'1'
Now add a test for the field in your asp like.....PS don't forget the
end if
<%
If request.form("SubmitValue") =3D "1" then
dim toneid,singer,country
toneid=3DRequest("toneid")
singer=3DRequest("singer")
country=3DRequest("country")
set cn=3Dserver.createobject("ADODB.Connection")
cn.Open "DBQ=3D" & Server.Mappath("satalcity2.mdb") &
";Driver=3D{Microsoft
Access Driver (*.mdb)};"
sql=3D"insert into tbl_tones_master1(singer,country) values
('"&singer&"','"&country&"') where tone_id=3D'"&toneid&"'" cn.Execute
sql
cn.Close
End if
%>
-----Original Message-----
From: arshad siddiqui [mailto:ash_arshad@y...]
Sent: Wednesday, May 01, 2002 9:58 AM
To: ASP Databases
Subject: [asp_databases] sql statement
Hi,
Please somebody tell me what sql statement shall I use
if I want to insert in few of the columns.
For example suppose I have a table in which I have
four columns i.e toneid,tonename,country,singer
toneid and tonename are filled but country and singer
are empty.I am using the following code but when I run
the script,there is no change in the database and also
no error is coming.
My code:
<%
dim toneid,singer,country
toneid=3DRequest("toneid")
singer=3DRequest("singer")
country=3DRequest("country")
set cn=3Dserver.createobject("ADODB.Connection")
cn.Open "DBQ=3D" & Server.Mappath("satalcity2.mdb") &
";Driver=3D{Microsoft
Access Driver (*.mdb)};" sql=3D"insert into
tbl_tones_master1(singer,country) values ('"&singer&"','"&country&"')
where tone_id=3D'"&toneid&"'" cn.Execute sql cn.Close
%>
<HTML><HEAD></head>
<BODY>
<P align=3Dcenter><STRONG><FONT size=3D4>Singer and
country
Upload</FONT></STRONG></P>
<form method=3D"post" action=3D"uploadsinger.asp">
<P align=3Dcenter><STRONG><FONT
size=3D4></FONT></STRONG> </P>
<P align=3Dcenter><STRONG><FONT size=3D4>Tone_id </FONT></STRONG><input
type=3Dtoneid name=3Dtext1></P> <P align=3Dcenter><STRONG><FONT
size=3D4>Singer</FONT></STRONG><input type=3Dsinger name=3Dtext2></P> <P
align=3Dcenter><STRONG><FONT size=3D4>Country</FONT></STRONG><input
type=3Dcountry name=3Dtext3></P> <P align=3Dcenter><input
type=3D"submit"
value=3D"Upload" name=3D"B1"></p></form> </BODY></HTML>
Please help
Thank You
Best regards
--Arshad--
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
Message #4 by arshad siddiqui <ash_arshad@y...> on Wed, 1 May 2002 06:57:44 -0700 (PDT)
|
|
Hi,
Please somebody tell me what sql statement shall I use
if I want to insert in few of the columns.
For example suppose I have a table in which I have
four columns i.e toneid,tonename,country,singer
toneid and tonename are filled but country and singer
are empty.I am using the following code but when I run
the script,there is no change in the database and also
no error is coming.
My code:
<%
dim toneid,singer,country
toneid=Request("toneid")
singer=Request("singer")
country=Request("country")
set cn=server.createobject("ADODB.Connection")
cn.Open "DBQ=" & Server.Mappath("satalcity2.mdb") &
";Driver={Microsoft Access Driver (*.mdb)};"
sql="insert into tbl_tones_master1(singer,country)
values ('"&singer&"','"&country&"') where
tone_id='"&toneid&"'"
cn.Execute sql
cn.Close
%>
<HTML><HEAD></head>
<BODY>
<P align=center><STRONG><FONT size=4>Singer and
country
Upload</FONT></STRONG></P>
<form method="post" action="uploadsinger.asp">
<P align=center><STRONG><FONT
size=4></FONT></STRONG> </P>
<P align=center><STRONG><FONT size=4>Tone_id
</FONT></STRONG><input type=toneid name=text1></P>
<P align=center><STRONG><FONT
size=4>Singer</FONT></STRONG><input type=singer
name=text2></P>
<P align=center><STRONG><FONT
size=4>Country</FONT></STRONG><input type=country
name=text3></P>
<P align=center><input type="submit" value="Upload"
name="B1"></p></form>
</BODY></HTML>
Please help
Thank You
Best regards
--Arshad--
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
Message #5 by arshad siddiqui <ash_arshad@y...> on Wed, 1 May 2002 07:11:09 -0700 (PDT)
|
|
Hello,
Please somebody tell me what sql statement shall I use
if I want to insert in few of the columns.
For example suppose I have a table in which I have
four columns i.e toneid,tonename,country,singer
toneid and tonename are filled but country and singer
are empty.I am using the following code but when I run
the script,there is no change in the database and also
no error is coming.
My code:
<%
dim toneid,singer,country
toneid=Request("toneid")
singer=Request("singer")
country=Request("country")
set cn=server.createobject("ADODB.Connection")
cn.Open "DBQ=" & Server.Mappath("satalcity2.mdb") &
";Driver={Microsoft Access Driver (*.mdb)};"
sql="insert into tbl_tones_master1(singer,country)
values ('"&singer&"','"&country&"') where
tone_id='"&toneid&"'"
cn.Execute sql
cn.Close
%>
<HTML><HEAD></head>
<BODY>
<P align=center><STRONG><FONT size=4>Singer and
country
Upload</FONT></STRONG></P>
<form method="post" action="uploadsinger.asp">
<P align=center><STRONG><FONT
size=4></FONT></STRONG> </P>
<P align=center><STRONG><FONT size=4>Tone_id
</FONT></STRONG><input type=toneid name=text1></P>
<P align=center><STRONG><FONT
size=4>Singer</FONT></STRONG><input type=singer
name=text2></P>
<P align=center><STRONG><FONT
size=4>Country</FONT></STRONG><input type=country
name=text3></P>
<P align=center><input type="submit" value="Upload"
name="B1"></p></form>
</BODY></HTML>
Please help
Thank You
Best regards
--Arshad--
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
Message #6 by Mark Eckeard <meckeard2000@y...> on Wed, 1 May 2002 07:31:40 -0700 (PDT)
|
|
Arshad,
Do a response.write on the tone_id to make sure it's
there.
Mark.
--- arshad siddiqui <ash_arshad@y...> wrote:
> Hi,
> Please somebody tell me what sql statement shall I
> use
> if I want to insert in few of the columns.
> For example suppose I have a table in which I have
> four columns i.e toneid,tonename,country,singer
> toneid and tonename are filled but country and
> singer
> are empty.I am using the following code but when I
> run
> the script,there is no change in the database and
> also
> no error is coming.
>
>
> My code:
> <%
> dim toneid,singer,country
> toneid=Request("toneid")
> singer=Request("singer")
> country=Request("country")
>
> set cn=server.createobject("ADODB.Connection")
> cn.Open "DBQ=" & Server.Mappath("satalcity2.mdb") &
> ";Driver={Microsoft Access Driver (*.mdb)};"
> sql="insert into tbl_tones_master1(singer,country)
> values ('"&singer&"','"&country&"') where
> tone_id='"&toneid&"'"
> cn.Execute sql
> cn.Close
>
> %>
> <HTML><HEAD></head>
> <BODY>
> <P align=center><STRONG><FONT size=4>Singer and
> country
> Upload</FONT></STRONG></P>
> <form method="post" action="uploadsinger.asp">
> <P align=center><STRONG><FONT
> size=4></FONT></STRONG> </P>
> <P align=center><STRONG><FONT size=4>Tone_id
> </FONT></STRONG><input type=toneid name=text1></P>
> <P align=center><STRONG><FONT
> size=4>Singer</FONT></STRONG><input type=singer
> name=text2></P>
> <P align=center><STRONG><FONT
> size=4>Country</FONT></STRONG><input type=country
> name=text3></P>
> <P align=center><input type="submit" value="Upload"
> name="B1"></p></form>
> </BODY></HTML>
>
>
> Please help
> Thank You
> Best regards
> --Arshad--
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
|
|
 |