-
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
-
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.
-
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