Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Insert into problem

0 views
Skip to first unread message

franck

unread,
Jan 30, 2001, 7:14:12 PM1/30/01
to
Greetings,

I want to add an url and description in an access database containing 10
differents tables.
The drop down menu from the my form is called cate . "cate" is the name of
the table where the url and description will be inserted.

Here's the script :
<%
cate=request("cate")
if cate="1" then
cate="editions"
elseif cate="2" then
cate="paroles"
elseif cate="3" then
cate="partitions"
elseif cate="4" then
cate="droits"
elseif cate="5" then
cate="associations"
elseif cate="6" then
cate="artistes"
elseif cate="7" then
cate="voix"
elseif cate="8" then
cate="biblio"
elseif cate="9" then
cate="radio"
elseif cate="10" then
cate="instrumentale"
Else cate="erreurs"
end if
url=request("url")
description=request("description")
%>

<%
Query = "INSERT INTO <%=cate%> (url,description) VALUES ("
Query = Query & "'" & url & "','" & description & "')"

Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "liens"
Set RSlist = Server.CreateObject("ADODB.recordset")
RSlist.Open Query,DataConn,3
%>

The problem is in the following part : Query = "INSERT INTO <%=cate%>
How do I configure the script so that it understands that <%=cate%> is the
drop down menu value ?

Thanks in advance

Best regards

Franck


Bob Lehmann

unread,
Jan 30, 2001, 8:42:11 PM1/30/01
to
INSERT INTO " & cate & " (url,description)

Bob Lehmann

"franck" <d...@yahoo.com> wrote in message
news:957lg8$3pu$1...@stu1id2.ip.tesion.net...

Aaron Bertrand [MVP]

unread,
Jan 30, 2001, 9:12:20 PM1/30/01
to
You're getting mixed up. You're already in a script block, but you're
telling the ASP engine to start another script block and response.write a
string.

> <%
> Query = "INSERT INTO <%=cate%> (url,description) VALUES ("

Should be

<%
Query = "INSERT INTO " & cate & " (url,description) VALUES ("

(This is another of those reasons I prefer to write all my HTML from ASP as
opposed to interspersing HTML and <%%> blocks -- you're never confused about
which kind of block you're in.)

--
http://www.aspfaq.com/


0 new messages