Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to sql server 2005 DB through asp 2

Status
Not open for further replies.

Tr0

Programmer
Jul 12, 2007
24
US
I am trying to create a connection to a SQL Server 2005 DB within an ASP page using the following code:

Set Conn= Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=SQLOLEDB; Data Source = "" Initial Catalog = ""; User Id = ""; Password=''"

The error message I am receiving says that the set conn method is outdated. Is there a better way to create a connection?

 
Thanks for the link to the page...

Its everything I could ever want :)
 
Are you using windows authencation if not you should it is more secure. My opinion.

If you are using it the link below is how to connect:


set rs = Server.CreateObject ("ADODB.Recordset")
Set conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = "Provider=SQLNCLI;Server=SERVER\SQLEXPRESS;Database=Your_Data_Base_Name_Here;Trusted_Connection=yes;"
Conn.Open
 
Thanks for your opinion anon I will keep that in mind.
 
set cnn = server.createobject("ADODB.Connection")

cnn.open "Provider=SQLOLEDB; Data Source=mydb/sqlexpress;UID=;PWD=;DATABASE= "
set comm=server.createobject("ADODB.Command")

This works for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top