尝试使用经典 ASP 在 Access 中添加记录时出现错误 80040e07。该代码昨天运行良好。
Microsoft JET 数据库引擎错误“80040e07”
条件表达式中的数据类型不匹配。
/alumni/admin/addvalue.asp,第 3 行
btitle 、bname、baddress、bphone和bpincode字段可以为空,而其他字段为必填项。
我的代码:
dim conn, rs, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, concat, sqlstr
Set conn=Server.createObject("ADODB.Connection")
Set rs=Server.createObject("ADODB.Recordset")
conn.open="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("\alumni/alumni.mdb") & ""
t1=Request.form("txtfname")
t2=Request.form("txtlname")
t3=Request.form("txtprn")
t4=Request.form("txtbdate")
t5=Request.form("gender")
t6=Request.form("txtmail")
t7=Request.form("txtaddrs")
t8=Request.form("txtcity")
t9=Request.form("txtstate")
t10=Request.form("txtpincode")
t11=Request.form("txtpphone")
t12=Request.form("txtsecphone")
t13=Request.form("drpdegree")
t14=Request.form("drppassyear")
t15=Request.form("txtdesg")
t16=Request.form("txtcname")
t17=Request.form("txtcaddr")
t18=Request.form("txtccity")
t19=Request.form("txtcstate")
t20=Request.form("txtcpincode")
t21=Request.form("txtcphone")
t22=Request.form("txtcmail")
concat=t14&t3
if(t20="")then
t20=0
end if
sqlstr="insert into users(userid,passwd,utype,ufname,ulname,uprnumber,ubdate,ugender,uemail,uaddress,ucity,ustate,upincode,upphone,usphone,udegree,upassyear,btitle,bname,baddress,bcity,bstate,bpincode,bphone,bemail)values('"&t6&"','"&concat&"','student','"&t1&"','"&t2&"','"&t3&"','"&t4&"','"&t5&"','"&t6&"','"&t7&"','"&t8&"','"&t9&"','"&t10&"','"&t11&"','"&t12&"','"&t13&"','"&t14&"','"&t15&"','"&t16&"','"&t17&"','"&t18&"','"&t19&"','"&t20&"','"&t21&"','"&t22&"')"
response.write("this is the string"&sqlstr)
'response.write("THIS IS PASSWORD "+concat)
rs.open "insert into users(userid,passwd,utype,ufname,ulname,uprnumber,ubdate,ugender,uemail,uaddress,ucity,ustate,upincode,upphone,usphone,udegree,upassyear,btitle,bname,baddress,bcity,bstate,bpincode,bphone,bemail)values('"&t6&"','"&concat&"','student','"&t1&"','"&t2&"','"&t3&"','"&t4&"','"&t5&"','"&t6&"','"&t7&"','"&t8&"','"&t9&"','"&t10&"','"&t11&"','"&t12&"','"&t13&"','"&t14&"','"&t15&"','"&t16&"','"&t17&"','"&t18&"','"&t19&"',"&t20&",'"&t21&"','"&t22&"')",conn
JavaScript 代码:
var fname = '<%=t1&t2%>';
var email='<%=t6%>';
var passwd='<%=concat%>';
alert('hi,'+fname+'your regestration is successful.'+'\nyour Id='+email+'\nPassword='+passwd);
window.location="http://localhost/alumni/default.asp";