MS SQL connection

A

Atse

By the way, how can I do if I don't want to write those lines on every pages
but write once somewhere and effect all pages, like making a global
connection? Can I?
Thanks again.
 
A

Aaron Bertrand [MVP]

No, you shouldn't do that, but you could use an #include file (or
global.asa) that has the connection string defined, then wherever you need
it you just say

set conn = server.createobject("ADODB.Connection")
conn.open connectionString ' or session("connectionString")

--
Aaron Bertrand, SQL Server MVP
http://www.aspfaq.com/

Please reply in the newsgroups, but if you absolutely
must reply via e-mail, please take out the TRASH.
 
A

Aaron Bertrand [MVP]

You mean I can do that like below?
<%
' this is in the page global.asa
cst = "Provider=SQLOLEDB;Server=<ip address>;database=<dbname>;"
cst = cst & "network=DBMSSOCN;uid=<uid>;pwd=<pwd>"
set conn = Server.CreateObject("ADODB.Connection")

This last line should *NOT* be in global.asa
<!--#include file=global.asa>

No, you don't #include global.asa. If you just want to #include a file,
name it something else, like connection.asp ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,076
Messages
2,570,565
Members
47,201
Latest member
IvyTeeter

Latest Threads

Top