麻烦高手指正,asp页面获取字符串拆分后写入数据表,无报错,但是数据无法写入数据表,字段都是文本型
<!--#includefile="conn.asp"--><%dimtnumdimtnum1dimbdimcifrequest("try")="输入"thentnum=...
<!--#include file="conn.asp"-->
<%
dim tnum
dim tnum1
dim b
dim c
if request("try")=" 输 入 " then
tnum=trim(request.form("idd"))
b=trim(request.form("add"))
c=trim(request.form("tf"))
tnum1=split(tnum, ",")
if ubound(tnum1)=5 then
sql= "insert into card(id1,id2,id3,id4,id5,ad,status)values('"&tnum(0)&"','"&tnum(1)&"','"&tnum(2)&"','"&tnum(3)&"','"&tnum(4)&"','"&b&"','"&c&"')"
rs.Open sql,conn,3,3
conn.execute(sql)
rs.close
conn.close
response.redirect "index2.asp"
end if
end if
%>
<%
response.write(tnum1(0))
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="images/css.css" rel="stylesheet" type="text/css" />
<title>登陆页面</title>
</head>
<body>
<table width="819" align="center" border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="post" action="index2.asp" onSubmit="return CheckForm()">
<tr><td width="819" height="60"></td></tr>
<tr><td style="height:50px;color:#049;font-size:24px;font-weight:bold;text-align:center">卡片出入统计系统</td></tr>
<tr>
<td style="height:35px;font-size:14;text-align:center">I D:<input type="text" name="idd" maxlength="30" size="24" /></td>
</tr>
<tr><!-- -->
<td style="height:35px;font-size:14;text-align:center">地 点:
<input name="add" type="text" value="采购部" size="24" maxlength="22" readonly="readonly" /></td>
</tr>
<tr>
<td style="height:35px;font-size:14;text-align:center">出入标志:<input name="tf" type="text" value="入" size="24" maxlength="22" readonly="readonly" /></td>
</tr>
<tr>
<td style="height:40px;color:#049;text-align:center"><input type="submit" name="try" value=" 输 入 " /></td>
</tr>
</form>
</table>
</body>
</html>
上面是输入界面,conn.asp这个是连接界面
<%
dim conn,rs,sql
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/data.mdb")
set rs=server.createobject("adodb.recordset")
%>
给出修正方案和代码,高分求教 展开
<%
dim tnum
dim tnum1
dim b
dim c
if request("try")=" 输 入 " then
tnum=trim(request.form("idd"))
b=trim(request.form("add"))
c=trim(request.form("tf"))
tnum1=split(tnum, ",")
if ubound(tnum1)=5 then
sql= "insert into card(id1,id2,id3,id4,id5,ad,status)values('"&tnum(0)&"','"&tnum(1)&"','"&tnum(2)&"','"&tnum(3)&"','"&tnum(4)&"','"&b&"','"&c&"')"
rs.Open sql,conn,3,3
conn.execute(sql)
rs.close
conn.close
response.redirect "index2.asp"
end if
end if
%>
<%
response.write(tnum1(0))
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="images/css.css" rel="stylesheet" type="text/css" />
<title>登陆页面</title>
</head>
<body>
<table width="819" align="center" border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="post" action="index2.asp" onSubmit="return CheckForm()">
<tr><td width="819" height="60"></td></tr>
<tr><td style="height:50px;color:#049;font-size:24px;font-weight:bold;text-align:center">卡片出入统计系统</td></tr>
<tr>
<td style="height:35px;font-size:14;text-align:center">I D:<input type="text" name="idd" maxlength="30" size="24" /></td>
</tr>
<tr><!-- -->
<td style="height:35px;font-size:14;text-align:center">地 点:
<input name="add" type="text" value="采购部" size="24" maxlength="22" readonly="readonly" /></td>
</tr>
<tr>
<td style="height:35px;font-size:14;text-align:center">出入标志:<input name="tf" type="text" value="入" size="24" maxlength="22" readonly="readonly" /></td>
</tr>
<tr>
<td style="height:40px;color:#049;text-align:center"><input type="submit" name="try" value=" 输 入 " /></td>
</tr>
</form>
</table>
</body>
</html>
上面是输入界面,conn.asp这个是连接界面
<%
dim conn,rs,sql
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/data.mdb")
set rs=server.createobject("adodb.recordset")
%>
给出修正方案和代码,高分求教 展开
2个回答
展开全部
dim tnum
dim tnum1
dim b
dim c
if request("try")=" 输 入 " then
tnum=trim(request.form("idd"))
b=trim(request.form("add"))
c=trim(request.form("tf"))
tnum1=split(tnum, ",")
if ubound(tnum1)=5 then
sql= "insert into card(id1,id2,id3,id4,id5,ad,status)values('"&tnum1(0)&"','"&tnum1(1)&"','"&tnum1(2)&"','"&tnum1(3)&"','"&tnum1(4)&"','"&b&"','"&c&"')"
rs.Open sql,conn,3,3
conn.execute(sql)
rs.close
conn.close
response.redirect "index2.asp"
end if
end if
dim tnum1
dim b
dim c
if request("try")=" 输 入 " then
tnum=trim(request.form("idd"))
b=trim(request.form("add"))
c=trim(request.form("tf"))
tnum1=split(tnum, ",")
if ubound(tnum1)=5 then
sql= "insert into card(id1,id2,id3,id4,id5,ad,status)values('"&tnum1(0)&"','"&tnum1(1)&"','"&tnum1(2)&"','"&tnum1(3)&"','"&tnum1(4)&"','"&b&"','"&c&"')"
rs.Open sql,conn,3,3
conn.execute(sql)
rs.close
conn.close
response.redirect "index2.asp"
end if
end if
更多追问追答
追问
只是修改了rs.Open sql,conn,3,3这行?我改了,还是写不进去,也没提示报错
追答
dim tnum
dim tnum1
dim b
dim c
if request("try")=" 输 入 " then
tnum=trim(request.form("idd"))
b=trim(request.form("add"))
c=trim(request.form("tf"))
tnum1=split(tnum, ",")
if ubound(tnum1)=5 then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from card"
rs.open sql,conn,1,3
rs.addnew
rs("id1")=tnum1(0)
rs("id2")=tnum1(1)
rs("id3")=tnum1(2)
rs("id4")=tnum1(3)
rs("id5")=tnum1(4)
rs("ad")=b
rs("status")=c
rs.update
rs.close
conn.close
response.redirect "index2.asp"
end if
end if
换成以上这种方法看看呢?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询