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
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Nov | ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 | |
RSS feed for comments on this post · TrackBack URI
Leave a reply