更新datagridview时,条件表达式中的数据类型不匹配

时间:2014-05-04 08:19:01

标签: visual-studio-2008 datagridview

我想从文本框更新我的数据然后当我点击更新按钮时。 da.Update(ds," Months")

出错

我希望有人能尽快咨询

Private Sub btnUpdate_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理btnUpdate.Click

    Dim cb As New OleDb.OleDbCommandBuilder(da)

    ds.Tables("Months").Rows(inc).Item(0) = txtID.Text
    ds.Tables("Months").Rows(inc).Item(1) = txtStudentName.Text
    ds.Tables("Months").Rows(inc).Item(2) = textbox1.Text
    ds.Tables("Months").Rows(inc).Item(3) = textbox2.Text
    ds.Tables("Months").Rows(inc).Item(4) = TextBox3.Text
    ds.Tables("Months").Rows(inc).Item(5) = TextBox4.Text
    ds.Tables("Months").Rows(inc).Item(6) = TextBox5.Text
    ds.Tables("Months").Rows(inc).Item(7) = TextBox6.Text
    ds.Tables("Months").Rows(inc).Item(8) = TextBox7.Text
    ds.Tables("Months").Rows(inc).Item(9) = TextBox8.Text
    ds.Tables("Months").Rows(inc).Item(10) = TextBox9.Text
    ds.Tables("Months").Rows(inc).Item(11) = TextBox10.Text
    ds.Tables("Months").Rows(inc).Item(12) = TextBox11.Text
    ds.Tables("Months").Rows(inc).Item(13) = TextBox12.Text
    ds.Tables("Months").Rows(inc).Item(14) = TextBox13.Text
    ds.Tables("Months").Rows(inc).Item(15) = TextBox14.Text
    ds.Tables("Months").Rows(inc).Item(16) = TextBox15.Text
    ds.Tables("Months").Rows(inc).Item(17) = TextBox16.Text
    ds.Tables("Months").Rows(inc).Item(18) = TextBox17.Text
    ds.Tables("Months").Rows(inc).Item(19) = TextBox18.Text
    ds.Tables("Months").Rows(inc).Item(20) = TextBox18.Text
    ds.Tables("Months").Rows(inc).Item(21) = TextBox19.Text
    ds.Tables("Months").Rows(inc).Item(22) = TextBox20.Text
    ds.Tables("Months").Rows(inc).Item(23) = TextBox21.Text
    ds.Tables("Months").Rows(inc).Item(24) = TextBox22.Text
    ds.Tables("Months").Rows(inc).Item(25) = TextBox23.Text
    ds.Tables("Months").Rows(inc).Item(26) = TextBox24.Text
    ds.Tables("Months").Rows(inc).Item(27) = TextBox25.Text
    ds.Tables("Months").Rows(inc).Item(28) = TextBox26.Text
    ds.Tables("Months").Rows(inc).Item(29) = TextBox27.Text
    ds.Tables("Months").Rows(inc).Item(30) = TextBox28.Text
    ds.Tables("Months").Rows(inc).Item(31) = TextBox29.Text
    ds.Tables("Months").Rows(inc).Item(32) = TextBox30.Text
    ds.Tables("Months").Rows(inc).Item(33) = txtNoAbsent.Text



    da.Update(ds, "Months")
    MsgBox("Data is updated")

End Sub

0 个答案:

没有答案