表:course
tkhide 类型:BOOLEAN
id 类型:INT
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click Dim dgi As DataGridItem
For Each dgi In datagrid1.Items
Dim id As Integer = Convert.ToInt32(datagrid1.DataKeys(dgi.ItemIndex))
Dim question As Boolean = CType(dgi.FindControl("checkbox1"), CheckBox).Checked
Dim updateSQL As String = "UPDATE course SET tkhide = @question WHERE id=" & id
Dim myCommand As New OleDbCommand(updateSQL, con)
con.Open()
myCommand.Parameters.Clear()
myCommand.Parameters.Add("@question", question)
myCommand.ExecuteNonQuery()
con.Close()
Next
BUTTON1 是提交按纽为什么checkbox打勾后,提交了,数据保存不到数据表里面呢》?
tkhide 类型:BOOLEAN
id 类型:INT
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click Dim dgi As DataGridItem
For Each dgi In datagrid1.Items
Dim id As Integer = Convert.ToInt32(datagrid1.DataKeys(dgi.ItemIndex))
Dim question As Boolean = CType(dgi.FindControl("checkbox1"), CheckBox).Checked
Dim updateSQL As String = "UPDATE course SET tkhide = @question WHERE id=" & id
Dim myCommand As New OleDbCommand(updateSQL, con)
con.Open()
myCommand.Parameters.Clear()
myCommand.Parameters.Add("@question", question)
myCommand.ExecuteNonQuery()
con.Close()
Next
BUTTON1 是提交按纽为什么checkbox打勾后,提交了,数据保存不到数据表里面呢》?
{
int count = 0;
for( int i=0;i < DataGrid2.Items.Count;i++ )
{
CheckBox ck = (CheckBox)DataGrid2.Items[i].Cells[0].FindControl("CheckBox1");
if( ck.Checked )
{
........
}
}
}