日期:2014-05-17  浏览次数:21356 次

关于'"'"和&的问题
<%
if country<>"" then
  sql="SELECT Companyname,Contactname,Country FROM Customers WHERE country='" & country & "'"
  set rs=Server.CreateObject("ADODB.Recordset")
  rs.Open sql,conn
%>

上个'" & country & "'"中的country是由request.form传的参数(country=request.form("country"))

------解决方案--------------------
HTML code

增加函数
function Do_add(table,direct)
set rs=server.createobject("adodb.recordset")
sql="select * from "&table&" where (id is null)" 
rs.open sql,conn,1,3
rs.addnew
for i= 1 to rs.fields.count-1
rs(i)=request(rs(i).name)
next
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.Redirect direct
end function