views:

215

answers:

2

Could someone please help solve this problem?

A: 

Here's a simple script that you can use:

<%

Dim conn

Set conn = Server.CreateObject("ADODB.Connection")

conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = Northwind; User Id = sa; Password="

If conn.errors.count = 0 Then

Response.Write "Connected OK"

End If

%>

And a def of the connection string members:

  • Provider: The provider value tells ADO which data provider it should call to give us access to the data that we need. "SQLOLEDB" is the best provider to use for Microsoft SQL Server 2000 databases. If we left out the provider value, then ADO would automatically default to the "MSDASQL" provider, which is Microsoft’s OLEDB provider for ODBC compatible data repositories.
  • Data Source: The data source value tells our provider the IP Address or netbios name of the computer on which our database is available. In our example above, I have used the value "(local)". This value tells the provider that our database resides on the local machine, and to use local procedure calls instead of remote procedure calls. Using this data source value makes data access faster because database function calls are not bounced across the network and back to the SQL Server like they are normally.
  • Initial Catalog: The initial catalog value is just a fancy name for the database that the provider should connect us to by default.
  • User Id: The login Id of the SQL Server user account that the provider should use during the authentication process.
  • Password: The password of the SQL Server use account that the provider should use during the authentication process.

Hope this helps!

jlech
Thank you. Boy, that was fast!
joel
A: 
<% 'database
dbserver = ""
dbcatalog = ""
dblogin = ""
dbpassword = ""
'connection string
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open = "Provider=SQLOLEDB; Data Source=" & dbserver & ";Initial Catalog=" & dbcatalog & ";User Id=" & dblogin & ";Password=" & dbpassword
 %>

this is the one i use. check out http://www.connectionstrings.com/ for a bunch more

Carter Cole