本文章介紹了利用asp連接sqlserver數據庫實例代碼
通過driver建立連接
代碼如下 <%Const DataBaseType=
If DataBaseType=
DBPath="/jb
SqlNowString = "Now()"
ystr=true
nstr=false
suiji="rnd(id)"
Else
DataServer = "www
DataUser = "jb
DataBaseName = "jb
DataBasePsw = "密碼"
SqlNowString = "getdate()"
ystr=
nstr=
suiji="newid()"
End if
On Error Resume Next
If DataBaseType =
ConnStr="driver={SQL Server};server="&dataserver&";UID="&datauser&";PWD="&databasepsw&";Database="&databasename
Else
ConnStr = "Provider=Microsoft
End If
Set conn = Server
conn
If Err Then Err
%>
通過driver建立連接
通過driver建立頁面與數據庫的連接
conn
編寫腳本和數據庫源建立連接
ADO(ActiveX Data Objects ) 提供 Connection 對象
Dim StrServer
StrServer="(local)"
StrUid="testuser"
StrSaPwd="
StrDbName="db_test_com"
Dim Conn
Dim StrDSN
Dim Rs
StrDSN="driver={SQL server};server="&StrServer&";uid="&StrUid&";pwd="&StrSaPwd&";database="&StrDbName
set Conn = Server
set Rs=Server
Conn
From:http://tw.wingwit.com/Article/program/net/201311/14116.html