aRo` automating your e-commerce

6Feb/06
This blog has been neglected due to the success of Solidshops.com

Connection to access or MS SQL database in ASP

The best way of connecting to a database is including a separated file with the database info. Afterwards u can always check if the database connection state is open.

MS SQL
set cnn = Server.CreateObject(“ADODB.Connection”)
cnn.ConnectionString = “Provider=SQLOLEDB.1;User ID=User;Passwd=;Initial Catalog=ASPDB;Data Source=server”
cnn.Open

Microsoft Access
set cnn = Server.CreateObject(“ADODB.Connection”)
cnn.Provider = “Microsoft.Jet.OLEDB.4.0″
cnn.ConnectionString = Server.MapPath (“/mywwwfolder”) & “\database.mdb”
cnn.Open

check connection state
if cnn.State = 0 then
cnn.Open
end if

Popularity: 3% [?]

Filed under: asp Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.