function acc_sql(sql,adotype,adodct,strlong,values)
dim connstring,mycmd,myrs,conn
connString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db1.mdb")
set conn = Server.CreateObject("Adodb.Connection")
conn.ConnectionString = connString
conn.open()
set mycmd = Server.CreateObject("ADODB.Command")
mycmd.ActiveConnection=conn
mycmd.CommandText=sql
mycmd.Prepared = true
set mypar = mycmd.CreateParameter("temp",adotype,adodct,strlong,values)
mycmd.Parameters.Append mypar
set myrs = mycmd.Execute
set acc_sql=myrs
end function
'调用方法
'dim rs
'sql="select * from users where id=? order by id"
'set rs=acc_sql(sql,3,1,4,1)
'if not rs.eof then
'response.Write(rs(1))
'end if
您可能感兴趣的文章: