• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

ASP include files and databases?

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
browolf
Trusted SF Member
Trusted SF Member


Joined: 19 Apr 2002
Posts: 1


Offline

PostPosted: Mon Nov 11, 2002 6:01 pm    Post subject: ASP include files and databases? Reply with quote

Hi,

i've been reading how good it is to use include files to open database connections in ASP.

but I'm wondering...

where do you close the database connection? do u even have to?
Doen an open database connection stay open if u change pages?

cheers

Andy
Back to top
View user's profile Send private message
ShaolinTiger
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777215
Location: Kuala Lumpur, Malaysia

Offline

PostPosted: Mon Nov 11, 2002 6:20 pm    Post subject: Reply with quote

Yeh always use an include and a system DSN, but for the connection string rather than the connection itself.

Then you don't have to type the stupid code in each page.

You still have to open and close the connection as needed.

If you open a connection and don't close it when you change pages etc things get ugly.

Don't use the .inc extension if you use includes, use .asp Smile

My connection file would look something like this:

Code:
<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
MM_sitename_STRING = "dsn=dsnstring;uid=;pw=;"
%>


Then to include it:

Code:
<!--#include file="Connections/filename.asp" -->


Then use the data by creating recordsets on each page and doing your biz on those.
Back to top
View user's profile Send private message Visit poster's website
Jason
Forum Fanatic
Forum Fanatic


Joined: 19 Sep 2002
Posts: 16777215


Offline

PostPosted: Mon Nov 11, 2002 7:37 pm    Post subject: Reply with quote

A book worth looking at is SAM's "teach yourself ASP 2.0 in 21 Days".

Covers a bit of everything, a good start for the aspiring ASP Programmer.

J
Back to top
View user's profile Send private message Send e-mail
browolf
Trusted SF Member
Trusted SF Member


Joined: 19 Apr 2002
Posts: 1


Offline

PostPosted: Mon Nov 11, 2002 7:47 pm    Post subject: Reply with quote

i did loads of asp about 6 months ago.
I've been doing WSH recently, I seem to have forgotten how to do asp. heh Wink Crying or Very sad

i'd forgotten there was setting the connection and then doing open stuff. i remember using DSNless connections when i did it b4. It just seemed easier.

i'm just trying to figure out the best way to do it atm, with the least amount of work Wink

~ANdy
Back to top
View user's profile Send private message
chris
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777201
Location: ~/security-forums

Offline

PostPosted: Mon Nov 11, 2002 9:51 pm    Post subject: Reply with quote

SQL
Code:

Application("DataConnection") = "DRIVER={SQL Server};UID=user;PWD=pass;database=dbname;SERVER=localhost"


Access
Code:

Application("DataConnection") = "driver={Microsoft Access Driver (*.mdb)};dbq=" & replace(server.mappath("/"), "\db\") & "bleh.mdb"
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Looking for more Windows Networking info?

Sign up to the WindowsNetworking.com Monthly Newsletter, written by Enterprise Security MVP Deb Shinder, containing news, the hottest tips, Networking links of the month and much more. Subscribe today and don't miss a thing!
View a sample newsletter.

Become a WindowsNetworking.com member!

Discuss your Windows Networking issues with thousands of other Windows Newtorking experts. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred data recovery solution?

Follow TechGenix on Twitter