这又是怎么回事呢?
<%@ import namespace="system.data"%>
<%@import namespace="system.data.oledb"%>
<%@page language="vb" debug="true"%>
<script runat="server">
public newsid as string
public ds as dataset=new dataset
dim dr as datarow
dim conn as oledbconnection
Sub Page_Load(Src As Object, E As EventArgs)
newsid = Request.Params("id")
conn=new oledbconnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("../_Database\database.mdb"))
conn.open()
dim mycommand as oledbDataAdapter
mycommand=new oledbDataAdapter("select * from News where id "+newsid,conn)
mycommand.fill(ds,"News")
dr = ds.Tables("News").Rows(0)
Title.Text=dr("Title").ToString()
Content.Text=dr("Content").ToString()
end sub
Sub submit_Click(sender As Object,e As EventArgs)
dim mycommand as OLEDBcommand
dim conn as OLEDBconnection
dim TitleStr as string=Title.Text
dim ContentStr as string=Content.Text
conn=new OLEDBconnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("../_Database\database.mdb"))
Conn.open()
mycommand=new OLEDBcommand("UPDATE News set Title='" + TitleStr + "', Content='" + ContentStr + "',DateTime='" + Now.tostring() +"' WHERE id="+newsid,conn)
myCommand.ExecuteNonQuery()
Label1.Text="修改成功!"
End Sub
</script>
在这条语句中mycommand.fill(ds,"News")提示:语法错误 (操作符丢失) 在查询表达式 'id N' 中。
大家帮我看一下这是什么原因哟?
我真的好菜的,但还想学好这东东。