DataGrid中CheckBox的问题!高分求解,来者有分。。。。。。。
我在datagrid中设置一个checkbox,希望选中后,点击外部按钮更改该记录的一个字段DOING的值为1,可是点击后数据库没有变化????郁闷
下面是程序:请高手给予指正
sub pause_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
dim litem as datagriditem
dim id as integer
dim check as boolean
dim i as integer
for i=0 to mygrid1.items.count -1
check=ctype(litem.findcontrol("choice"),checkbox).checked
if check then
ID=Int32.Parse(mygrid1.DataKeys(i).ToString())
update()
databind
end if
next
end sub
sub update()
Dim conNorthwind As oledbConnection
Dim strInsert As String
Dim cmdInsert As oledbCommand
Dim Provider = "Provider=Microsoft.Jet.OLEDB.4.0"
Dim Database = "Data Source=" & Server.MapPath( "data/ris.mdb" )
conNorthwind = New OleDbConnection( Provider & ";" & DataBase )
strInsert = "update booking set doing=1 where PAT_ID=id"
cmdInsert = New oledbCommand( strInsert, conNorthwind )
conNorthwind.Open()
cmdInsert.ExecuteNonQuery()
conNorthwind.Close()
end sub
该程序可以运行,但数据库未改变!
请各位高手随手帮忙。。。。。。。