Michael,
Many thanks for your kind and instant reply :O)
Do you mean that I only have to declare like these :
strconn="DRIVER=Microsoft Access Driver (*.mdb);DBQ="& Server.MapPath("x.mdb")
'for the first drop-down-list with Table_A:
set conn= server.createobject("adodb.connection")
conn.open strconn
set rs = server.createobject("adodb.recordset")
strsql= "SELECT * FROM Table_A order by id"
rs.open strsql, conn
response.write ("<select .... )
..
response.write ("</select> )
.....
'for the 2nd drop-down-list with Table_B :
set conn= server.createobject("adodb.connection")
conn.open strconn
set rs = server.createobject("adodb.recordset")
strsql= "SELECT * FROM Table_B order by id"
rs.open strsql, conn
response.write ("<select .... )
..
response.write ("</select> )
.....
'for the 3rd drop-down-list:
set conn= server.createobject("adodb.connection")
conn.open strconn
set rs = server.createobject("adodb.recordset")
strsql= "SELECT * FROM Table_C order by id"
rs.open strsql, conn
response.write ("<select .... )
..
response.write ("</select> )
Where should I better set db = Nothing?
TIA!!!
best regards,
Susan
----- Original Message -----
From: "Michael Elfial" <[EMAIL PROTECTED]>
To: "ActiveServerPages" <[EMAIL PROTECTED]>
Sent: Tuesday, August 13, 2002 11:48 PM
Subject: RE: preselect dropdown
> Hm, no of course:
>
> Just create one ADODB.Connection - open it once - somewhere before any DB
> activity
> and use it with all the recordsets like this:
>
> Set db = Server.CreateObject("ADODB.Connection")
> db.Open "here your db connect string goes"
> ' Something else ...
> And then:
> Set rst = db.Execute("Some query")
> ' Something else
> Set rst = Server.CreateObject("ADODB.Recordset")
> rst.Open "Another query", db, options...
>
> The ADODB.Connection represents your connection to the
> db thus keep it open as long as you need and close it after the last
> operation or
> if not sure at the very end of the page. In fact set db = Nothing will be
> better
> will close the connection while destroying the object.
>
>
>
>
> -----Original Message-----
> From: Susan Lin [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 13, 2001 5:06 PM
> To: ActiveServerPages
> Subject: Re: preselect dropdown
>
>
> Hi, dear all,
>
> It's great to know your discussion - for I do need this function to improve
> my program and it's not written in my 3 ASP handbooks.
>
> It works pretty good - thank you all. Just one question, since I have many
> tables (for instance table A, B, C,) in one X.mdb file to compose one
> request form's 3 drop-down-lists fields. Do I need to declare complete
> Driver, mappath, server object,set recordset etc. in lines each time for
> each table used in the drop-down-list?
>
> I tried to omit the same driver, mappath, object connection commands, it
> appeared error codes. Just would like to know how I can make it shorter in
> this program... Would appreciate your kind advise. TIA :O)
>
> best regards,
> Susan
---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]