 |
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

January 12th, 2005, 07:55 AM
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Easy but tricky for me... :(
Hello Guyz!!!
I`ve got the following lines of code...
<%
Dim oRSbg, pos, wh
dsnname= "anthem"
Set oRSbg=server.createobject("ADODB.recordset")
pos = "shadow"
sqlbg = "Select * from background WHERE position='" & pos & "' ORDER BY id DESC;"
oRSbg.open sqlbg, "DSN=anthem"
%>
What I want to do is to pass the variable of "dsnname" to the line where I open the DSN ("DSN=anthem"). SO... how do I have to do that?
Any ideas???
Thank you in advance!
Vagelis!
|

January 12th, 2005, 02:46 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
There are two ways to do it:
1.
dsnname = "DSN=anthem"
oRSbg.open sqlbg, dsnname
IMO, this is the easiest way, as it allows you to change the DSN to an OleDb connection later.
2.
oRSbg.open sqlbg, "DSN=" & dsnname
This way you hard code DSN= and use the variable dsnname for the actual DSN name.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|

January 13th, 2005, 06:24 AM
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you for your reply!
I guess that I`m not going to use the DSN connection though... I think that I`ll use a DSN-less connection. What`s your opinion on that? I think that it`s a bit faster.
|

January 13th, 2005, 11:21 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yeah, OledDB is faster and more reliable.
But what's more important: it's easier to manage. When you need to copy code from one server to another, all you need to do is copy the file. There is no need to access the server and use the ODBC panel to set up a DNS....
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |