如何调用上一篇数据处理函数ActionDB?
<%
' 首先要确定数据库连接字符串Application("connstr") ,当然你在ActionDB函数中确定也行
' Access 数据库连接字符串
Application("connstr") = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("YourAccessDB.Mdb")
' SQL Server2000 数据库连接字符串
' Application("connstr") = "provider=sqloledb;data source=localhost;initial catalog=YourDataBase;user id=sa;password=;"
Dim strSQL, arrList
Dim i
Dim hasList
Dim intID, strTitle, strContent
' 读取数据
strSQL = "Select * From YourTable"
If ActionDB(strSQL, arrList, 1) then
hasList = True
End If
If hasList then
For i=0 To Ubound(arrList, 2)
Response.write arrList(0, i) & "|" & arrList(1, i) & arrList(2, i) & "<br>" ' 第i行的字段内容
Next
Else
Response.write "暂时没有数据!"
End If
'增加或者删除数据
strSQL = "Insert Into YourTable(Tiletle, Content) Values('"& strTitle &"','" & strContent & "') '增加
'strSQL = "Delete From YourTable where ID=" & intID ' 删除
If ActionDB(strSQL, arrList, 0) then
Respose.Write "增加(或者删除)数据成功!"
else
Respose.Write "增加(或者删除)数据失败!"
End If
%>