asp中往数据库中添加数据为什么会有两条记录,有一条是空的
<%db="../db/com02.mdb"onerrorresumenextconnstr="DBQ="+server.mappath(""&db&"")+";Defa...
<%
db="../db/com02.mdb"
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
if err then
err.clear
else
conn.open connstr
end if
set rs=server.createobject("adodb.recordset")
sql="select * from shfw "
rs.open sql,conn,1,3
rs.AddNew
a=Trim(Request.form("CompanyName"))
b=Trim(Request.form("Receiver"))
c=Trim(Request.form("Phone"))
d=Trim(Request.form("Fax"))
e=Trim(Request.form("email"))
f=Trim(Request.form("Title"))
g=Trim(Request.form("Content"))
rs("CompanyName")=a
rs("Receiver")=b
rs("Phone")=c
rs("Fax")=d
rs("email")=e
rs("Title")=f
rs("Content")=g
rs.Update
rs.close
set rs=nothing
%> 展开
db="../db/com02.mdb"
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
if err then
err.clear
else
conn.open connstr
end if
set rs=server.createobject("adodb.recordset")
sql="select * from shfw "
rs.open sql,conn,1,3
rs.AddNew
a=Trim(Request.form("CompanyName"))
b=Trim(Request.form("Receiver"))
c=Trim(Request.form("Phone"))
d=Trim(Request.form("Fax"))
e=Trim(Request.form("email"))
f=Trim(Request.form("Title"))
g=Trim(Request.form("Content"))
rs("CompanyName")=a
rs("Receiver")=b
rs("Phone")=c
rs("Fax")=d
rs("email")=e
rs("Title")=f
rs("Content")=g
rs.Update
rs.close
set rs=nothing
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询