asp 连接 2008 数据库,那里错了!忘各位大侠指点!
<%Dim StrServer,StrUid,StrSaPwd,StrDbName,conn,StrDSN
StrServer="(local)"
StrUid="sa"
StrSaPwd="qwe`123"
StrDbName="bbs"
StrDSN="driver={sql server};server=" & StrServer &";uid=" & StrUid & ";pwd=" & StrSaPwd & ";database="& StrDbName & ";"
set conn=Server.CreateObject("ADODB.Connection")
conn.Open StrDSN
if conn.state=2 Then
Response.Write("正在连接")
else if conn.state=1 then
Response.Write("连接已经打开")
else
Response.Write("对不起,无法打开连接")
End if
%>