|
-
Apr 10th, 2001, 10:34 AM
#1
Thread Starter
Addicted Member
Hi Guys.
I'm trying to write a connection string and store it in a file called connection.asp.
I have included the file using
<!-- #INCLUDE FILE="Connection.asp" --> But I am having problems with string. Could someone please give me an example of using a connection string on a my Database.
It is a SQL Server DATABASE on a machine called "SQLSAMPLE" which is a different machine to the one that I am storing my ASP's on. The Username is "User"and the password is "password". I want to use ADO to connect. Could someone please let me know how to do this.
Thanks
JK
-
Apr 10th, 2001, 12:18 PM
#2
PowerPoster
Ok, i am not sure if this is what you want, but since no one else is helping, i will take a stab at it. I have a simular connection include file for connecting to an access database. I will post the contents below:
Code:
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("data.mdb")
objConn.Open
%>
That is for an access database. But it may give you an idea of the format or something.
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Apr 11th, 2001, 05:49 AM
#3
New Member
Why don't you try
<%
Dim objConn
Set objConn = Server.CreateObject ("ADODB.Connection")
objConn.Provider = "SQLOLEDB"
objConn.ConnectionString = "server=SQLSAMPLE;uid=user;pwd=Password;initial catalog = the name of your database"
objConn.Open
%>
I hope it proves useful
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|