ASP+ACCESS 插入数据时出错
ASP+ACCESS 插入数据时出错,我做的是一个表单插入数据到数据库里去的,输入完数据后提交后出错,它提示说:
Microsoft JET Database Engine '80040e14'
INSERT INTO 语句的语法错误。
\add.asp, line 97
现在将代码贴在下面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>添加新记录</title>
<style type="text/css">
<!--
body {
background-color: #FFFFCC;
}
-->
</style></head>
<body >
<form name="formadd" method="post" action="">
<table width="499" border="0" cellpadding="0" cellspacing="0"align="center">
<!--DWLayoutTable-->
<tr>
<td height="37" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="499" height="37" align="center"><font size="+3">新增记录</font></td><p><p><p>
</tr>
</table> </td>
</tr>
<tr >
<td width="97" height="22" align="center"> 姓名<!--strName--></td>
<td width="402" align="left" ><label>
<input name="textName" type="text">
</label></td>
</tr>
<tr >
<td height="21" align="center">性别</td>
<td align="left"><!--strAge-->
<label>
<input name="rad" type="radio" value="男">
男
<input type="radio" name="rad" value="女">
女</label></td>
</tr>
<tr>
<td height="23" align="center">年龄</td>
<td align="left" valign="top" ><label>
<input name="textAge" type="text">
</label></td>
</tr>
<tr>
<td height="26" align="center"> 电话<!--strTell--></td>
<td valign="top" ><label>
<input name="textTell" type="text">
</label></td>
</tr>
<tr>
<td height="25" align="center"> 邮箱<!--strEmail--> </td>
<td align="left"><label>
<input name="textEmail" type="text">
</label></td>
</tr>
<tr>
<td height="61" align="center">个人简介</td>
<td align="center"><label>
<textarea name="textinf" cols="55" rows="5"></textarea>
</label></td>
</tr>
<tr>
<td height="38" align="center" valign="top"><!--DWLayoutEmptyCell--> </td>
<td align="center"><label>
<input type="submit" name="Submit" value="确定">
</label></td>
</tr>
<tr>
<td height="0"></td>
<td></td>
</tr>
</table>
</form>
<% if request.Form("textName")<>"" and request.Form("textTell")<>"" then
dim strName,strSex,intAge,strTell,strEmail,strInf
strName=request.Form("textName")
strSex=request.Form("rad")
if request.Form("textAge")<>"" then
intAge=request.Form("textAge")
else
intAge=0
end if
strTell=request.Form("textTell")
strEmail=request.Form("textEmail")
strInf=request.Form("textinf")
'连接数据库
Set conn = Server.CreateObject("ADODB.Connection")
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &Server.MapPath("db/address.mdb")
conn.Open strConn
'下面添加数据
dim sql
sql="Insert Into tbUsers(strName,strSex,strAge,strTell,strEmail,strInf,dtmSubmit) value ('" & strName & "','" & strSex & "'," & intAge & ",'" & strTell & "','" & strEmail & "','" & strInf & "',#" & date() & "#)"
conn.execute(sql) (这就是第97行)
'添加记录以后返回首页
response.redirect "index.asp"
end if
%>
</body>
</html>