在线管理数据库 类(2)
sDBPath = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(sDBPath)
End Select
CheckData RLConn,sDbPath
End Property
'检查数据库链接,(变量名,连接字串)
Private Sub CheckData(DataConn,ConnStr)
On Error Resume Next
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open ConnStr
If Err Then
Err.Clear
Set DataConn = Nothing
ErrMsg("数据库连接出错:" & Replace(ConnStr,"\","\\") & ",\n请检查连接字串,确认您输入的数据库信息是否正确。")
Response.End
End If
End Sub
'检查表是否存在
Function CheckTable(TableName)
On Error Resume Next
RLConn.Execute("select * From " & TableName)
If Err.Number <> 0 Then
Err.Clear()
Call ErrMsg("错误提示:" & Err.Description)
CheckTable = False
Else
CheckTable = True
End If
End Function
'错误提示信息(消息)
Private Sub ErrMsg(msg)
Response.Write msg
Response.Flush
End Sub
'---------------------------------------字段值的操作-----------------------------------------------
'修改字段的值
内容版权声明:除非注明,否则皆为本站原创文章。