高分赠高手!一个关于ExecuteNonQuery的问题

来源:百度知道 编辑:UC知道 时间:2024/05/18 03:53:45
function executesql(sql as string)
mycmd=new oledbcommand(sql,myconn)
myconn.open()
mycmd.executenonquery()
myconn.close()
end function

sub page_load(sender as object,e as eventargs)
on error resume next
dim strconn as string
strconn="provider=microsoft.jet.4.0; data source="&server.MapPath("./")&"data/news.mdb"
myconn=new oledbconnection(strconn)
if session("user")="administrator" then
step1.visible="true"
if page.request("action")="add" then
dim title,author,from,content as string
dim classid,todayid as integer
title=page.request("title")
author=page.request("author")
from=page.request("from")
content=page.request("content")
classid=page.request("bigclass")
todayid=page.request("zhuanti")
sql="in

偶还是楼主
bigclassid,specialid都是自动编号类型
谢谢lgamoy,教教偶怎么改啊,如果能运行,分就是你的了

不好意思,刚才看的太快,没有注意这个sql。你数据类型好像有问题
dim classid,todayid as integer
classid=page.request("bigclass")
todayid=page.request("zhuanti")
上面字符串型隐士转换为整形是否有问题呢
你把你的SQL语句response.write出来看看,就知道SQL是否错了。

楼上大哥搞错了,人家本来就有哦mycmd=new oledbcommand(sql,myconn)
这里面的sql就是sql语句。

你可以调试一下,看看是不是数据类型的问题,你的news表看不到,bigclassid,specialid也都是文本类型么?我估计就是sql语句错误造成的。

bigclassid,specialid既然是自动编号,那就不用赋值了啊。还有你如果赋值的话,数字类型的,在sql语句中是不需要加上单引号的。

不知道