数据库连接错误:ODBC不支持所需属性!`
这是个在线考试系统添加试题程序,代码如下:
<%if session("password")<>"" then%>
<%if request("text1")="" then
response.write "<script language=Javascript>" & chr(13) & "alert('请输入用户
名!');" & "history.back()" & "</script>"
Response.End
end if
question=request("text1")
a=request("text2")
b=request("text3")
c=request("text4")
d=request("text5")
ans=request("text6")
set rs=server.createobject("adodb.recordset")
set rs1=server.createobject("adodb.recordset")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={SQL Server};server=(local);database=KaoShi;uid=sa;pwd=chaisen;"
sql="select * from test where question='"&question&"'"
rs.Open sql,conn,1,1
if rs.EOF or rs.bof then
sql="insert into test(question,a,b,c,d,ans) values
('"&question&"','"&a&"','"&b&"','"&c&"','"&d&"','"&ans&"')"
rs1.Open sql,conn,1,1
response.write "<script language=Javascript>" & chr(13) & "alert('信息添加成
功!');"&"window.location.href = 'add.asp'"&" </script>"
set rs1=nothing
else
response.write "<script language=Javascript>" & chr(13) & "alert('此信息已经添
加!');" & "history.back()" & "</script>"
end if
rs.Close
set rs=nothing
%>
<%else
Response.Redirect "20050130_loginagine.asp"
end if%>