access数据库无法添加新的数据?
下面是我的代码:dimrs,sqldimBigClassName,SmallClassName,IDdimTitle,Content,user,AddDate,okdim...
下面是我的代码:
dim rs,sql
dim BigClassName,SmallClassName,ID
dim Title,Content,user,AddDate,ok
dim DefaultPicUrl
Hits="0"
BigClassName=trim(request.form("BigClassName"))
SmallClassName=trim(request.form("SmallClassName"))
Title=trim(request.form("title"))
Content=trim(request.form("Content"))
Infotime=trim(request.form("AddDate"))
DefaultPicUrl=trim(request.form("DefaultPicUrl"))
Ok=trim(request.form("ok"))
User=trim(request.Form("user"))
if request("action")="Add" then
set rs=server.createobject("adodb.recordset")
sql="select * from News where (ID is null)"
rs.open sql,conn,1,3
rs.addnew
rs("Hits")="0"
rs("BigClassName")=BigClassName
rs("SmallClassName")=SmallClassName
rs("Title")=Title
rs("Content")=Content
rs("Ok")=Ok
rs("User")=User
rs("Infotime")=Infotime
rs("FirstImageName")=DefaultPicUrl
rs.update
ID=rs("ID")
rs.close
set rs=nothing
end if
我更改SQL语句为:
sql="INSERT INTO News (ID,Title,"
sql=sql & "BigClassName,SmallClassName,Content,Ok,User,Infotime)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("custid") & "',"
sql=sql & "'" & Request.Form("title") & "',"
sql=sql & "'" & Request.Form("BigClassName") & "',"
sql=sql & "'" & Request.Form("SmallClassName") & "',"
sql=sql & "'" & Request.Form("Content") & "',"
sql=sql & "'" & Request.Form("ok") & "',"
sql=sql & "'" & Request.Form("user") & "',"
sql=sql & "'" & Request.Form("AddDate") & "')"
on error resume next
conn.Execute sql
这样仍然不行,哪位高手解决一下 展开
dim rs,sql
dim BigClassName,SmallClassName,ID
dim Title,Content,user,AddDate,ok
dim DefaultPicUrl
Hits="0"
BigClassName=trim(request.form("BigClassName"))
SmallClassName=trim(request.form("SmallClassName"))
Title=trim(request.form("title"))
Content=trim(request.form("Content"))
Infotime=trim(request.form("AddDate"))
DefaultPicUrl=trim(request.form("DefaultPicUrl"))
Ok=trim(request.form("ok"))
User=trim(request.Form("user"))
if request("action")="Add" then
set rs=server.createobject("adodb.recordset")
sql="select * from News where (ID is null)"
rs.open sql,conn,1,3
rs.addnew
rs("Hits")="0"
rs("BigClassName")=BigClassName
rs("SmallClassName")=SmallClassName
rs("Title")=Title
rs("Content")=Content
rs("Ok")=Ok
rs("User")=User
rs("Infotime")=Infotime
rs("FirstImageName")=DefaultPicUrl
rs.update
ID=rs("ID")
rs.close
set rs=nothing
end if
我更改SQL语句为:
sql="INSERT INTO News (ID,Title,"
sql=sql & "BigClassName,SmallClassName,Content,Ok,User,Infotime)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("custid") & "',"
sql=sql & "'" & Request.Form("title") & "',"
sql=sql & "'" & Request.Form("BigClassName") & "',"
sql=sql & "'" & Request.Form("SmallClassName") & "',"
sql=sql & "'" & Request.Form("Content") & "',"
sql=sql & "'" & Request.Form("ok") & "',"
sql=sql & "'" & Request.Form("user") & "',"
sql=sql & "'" & Request.Form("AddDate") & "')"
on error resume next
conn.Execute sql
这样仍然不行,哪位高手解决一下 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询