主题:更新数据问题,谢谢各位了
sub page_load(sender as object,e as eventargs)
dim mycon as oledbconnection
dim mycmd as oledbdataadapter
dim str as string
dim strsql as string
str="provider=microsoft.jet.oledb.4.0;data source="& server.mappath("data/fang.mdb")
strsql = "select * from 表1 where 编号=1"
mycon = new oledbconnection(str)
mycmd = new oledbdataadapter(strsql,mycon)
dim ds as dataset = new dataset()
mycmd.fill(ds,"a1")
dim dr as datarow
dr = ds.tables("a1").rows(0)
aa.text = dr("日期")
bb.text = dr("数字")
end sub
sub qd(sender as object, e as eventargs)
dim mycon as oledbconnection
dim mycmd as oledbcommand
dim str,strsql as string
str="provider=microsoft.jet.oledb.4.0;data source="& server.mappath("data/fang.mdb")
mycon = new oledbconnection(str)
strsql="update 表1 set 日期='"& aa.text &"',数字='"& bb.text &"' where 编号=1"
mycmd = new oledbcommand(strsql,mycon)
mycmd.connection.open()
mycmd.executenonquery()
mycmd.connection.close()
end sub
源代码为以上,可为什么重写回库的时候总是写不进去呢?谢谢各位了。
dim mycon as oledbconnection
dim mycmd as oledbdataadapter
dim str as string
dim strsql as string
str="provider=microsoft.jet.oledb.4.0;data source="& server.mappath("data/fang.mdb")
strsql = "select * from 表1 where 编号=1"
mycon = new oledbconnection(str)
mycmd = new oledbdataadapter(strsql,mycon)
dim ds as dataset = new dataset()
mycmd.fill(ds,"a1")
dim dr as datarow
dr = ds.tables("a1").rows(0)
aa.text = dr("日期")
bb.text = dr("数字")
end sub
sub qd(sender as object, e as eventargs)
dim mycon as oledbconnection
dim mycmd as oledbcommand
dim str,strsql as string
str="provider=microsoft.jet.oledb.4.0;data source="& server.mappath("data/fang.mdb")
mycon = new oledbconnection(str)
strsql="update 表1 set 日期='"& aa.text &"',数字='"& bb.text &"' where 编号=1"
mycmd = new oledbcommand(strsql,mycon)
mycmd.connection.open()
mycmd.executenonquery()
mycmd.connection.close()
end sub
源代码为以上,可为什么重写回库的时候总是写不进去呢?谢谢各位了。