VBScript连接数据库

 1 'access类型

 2 dim strconn,objconn

 3 strconn="driver=microsoft access driver(*.mdb);dbq=" _

 4   & Server.MapPath("db.mdb")

 5 set objconn=Server.CreateObject("ADODB.Connection")

 6 objconn.open strconn

 7 'sql类型

 8 strconn="driver={sql server};descript=sqldemo;server=127.0.0.0;" _

 9   & "uid=loginid;password=;database=databasename"

10 set objconn=server.createobject("adodb.connection")

11 objconn.open strconn

 

你可能感兴趣的:(VBScript)