[求助]更新数据库问题,大家来看看啊,我的这个哪儿错了????
Sub XXeditItemCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)Dim dr As DataRow
dr = dt.Tables("NJ").Rows(e.Item.ItemIndex)
dr.Item("实际选修人数") = CStr(CInt(sjxx) + 1)
dt.Tables("NJ").AcceptChanges()
Session("dt") = dt
XKDataGrid.EditItemIndex = -1
XKDataGrid.DataSource = dt.Tables("NJ").DefaultView
XKDataGrid.DataBind()
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
ad.SelectCommand = New OleDb.OleDbCommand("select * from 年级选修课 where 年级='" & nj & "'", conn)
'执行数据库语句并填充数据到 DataTable 中
Dim ocb As New OleDbCommandBuilder(ad)
ad.UpdateCommand =ocb.GetUpdateCommand ()
ad.Update(dt, "NJ")
End Sub
也没显示错误,可就是更新不到数据库里..