asp获取数据库信息
发布网友
发布时间:2022-04-27 11:02
我来回答
共2个回答
热心网友
时间:2022-04-10 14:59
我没调试,你自己运行看看。
<%
Option Explicit
Response.Buffer = True
Dim Db
Dim Conn
Db = "data.mdb"
Call OpenConn
Sub OpenConn()
On Error Resume Next
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(Db)
If Err Then
Err.Clear
Conn.Close
Set Conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
End Sub
Sub CloseConn()
On Error Resume Next
If IsObject(Conn) Then
Conn.Close
Set Conn = Nothing
End If
End Sub
dim hardware
hardware=Request("hardware")
if hardware<>"" then
response.write conn.execute("SELECT * FROM ku_user WHERE hardware='"&hardware&"' and flag=true")(0)
end if
closeconn
%>
注:以上程序不防注入,存在安全隐患。来自:求助得到的回答
热心网友
时间:2022-04-10 16:17
使用asp探针试试