Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 30th, 2008, 03:53 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default connection string

How to write the connection string in ASP to connect to SQL Server from my Proxy server.

Reply With Quote
  #2 (permalink)  
Old February 14th, 2008, 08:59 AM
Friend of Wrox
Points: 489, Level: 7
Points: 489, Level: 7 Points: 489, Level: 7 Points: 489, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2006
Location: Berkshire, United Kingdom.
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default

I Normally create an includes connection page for all my SQL connections which make it easy to reference in my asp pages

an example of my connection asp page is

Asp page name - sqlconnection.asp

Code:
<%

'Declared SQL connection variables

Dim strSQLSN    ' SQL Server Instance
Dim strSQLDBUN    ' SQL Username
Dim strSQLDBPW    ' SQL Password
Dim strSQLDB    ' SQL Database name

'SQL Server current configuration

strSQLSN = "your-sever-name"                  ' SQL Server Instance
strSQLDBUN = "sql-login-name" ' SQL Username
strSQLDBPW = "your-password"             ' SQL Password
strSQLDB = "your-database-name"                       ' SQL Database name

' Connection String

VirConn = "Provider=SQLOLEDB;Server=" & strSQLSN & ";User ID=" & strSQLDBUN & ";Password=" & strSQLDBPW & ";Database=" & strSQLDB & ";"

%>
Then in the asp pages i want to connect to the db i use

Code:

then include

Code:
'Open Connect to DB
set dbconn = server.CreateObject ("ADODB.Connection")
    dbconn.connectionstring = VerConn
    dbconn.Open
Hope this helps

Aspless

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection string MunishBhatia ASP.NET 2.0 Professional 4 May 16th, 2007 05:50 AM
Connection String jmss66 Oracle 4 August 8th, 2006 03:19 AM
Connection String slgknjn VB Databases Basics 2 February 26th, 2005 02:14 AM
Connection String fs22 Classic ASP Databases 3 August 30th, 2004 01:25 AM
Connection String Help. diamond2165 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 7th, 2003 05:09 AM



All times are GMT -4. The time now is 08:12 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.