asp+access数据库如何改成asp+sql的,急求!!!
access的oconn.asp是这样的<%DimoConnIfNotIsObject(oConn)ThenCallDBConnBegin()SubDBConnBegin...
access的oconn.asp是这样的
<%
Dim oConn
If Not IsObject(oConn) Then Call DBConnBegin()
Sub DBConnBegin()
If IsObject(oConn) Then Exit Sub
Dim dbFilePath,dbFileName
dbFileName = DBP
dbFilePath = Server.MapPath(dbFileName)
Set oConn = Server.CreateObject("ADODB.Connection")
On Error Resume Next
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFilePath
If Err Then
Err.Clear
Response.Write "数据库连接错误!!"
Response.End
'Call ShowErrs()
End If
End Sub
Sub CloseConn()
on error resume next
if isobject(MyPage) then
set MyPage = Nothing
end if
if Isobject(objrs) then
objrs.close()
set objrs = nothing
end if
If IsObject(oConn) Then
oConn.Close
Set oConn = Nothing
End If
if err then err.clear
End Sub
%>
我的数据库是
oConn.Connectionstring= "Driver={SQL Server};Server=PC-200909251702\SQL;UID=sa;PWD=;Database=OA"
如何修改???
急求!!!在线等!!!
谢了,以后一定好好学!
好了!
非常感谢! 展开
<%
Dim oConn
If Not IsObject(oConn) Then Call DBConnBegin()
Sub DBConnBegin()
If IsObject(oConn) Then Exit Sub
Dim dbFilePath,dbFileName
dbFileName = DBP
dbFilePath = Server.MapPath(dbFileName)
Set oConn = Server.CreateObject("ADODB.Connection")
On Error Resume Next
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFilePath
If Err Then
Err.Clear
Response.Write "数据库连接错误!!"
Response.End
'Call ShowErrs()
End If
End Sub
Sub CloseConn()
on error resume next
if isobject(MyPage) then
set MyPage = Nothing
end if
if Isobject(objrs) then
objrs.close()
set objrs = nothing
end if
If IsObject(oConn) Then
oConn.Close
Set oConn = Nothing
End If
if err then err.clear
End Sub
%>
我的数据库是
oConn.Connectionstring= "Driver={SQL Server};Server=PC-200909251702\SQL;UID=sa;PWD=;Database=OA"
如何修改???
急求!!!在线等!!!
谢了,以后一定好好学!
好了!
非常感谢! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询