当前位置:编程学习 > C#/ASP.NET >>

关于OleDbDataAdapter.update


        MyODA.SelectCommand = New OleDb.OleDbCommand(Sql, Conn)
        cmdBuilder = New OleDb.OleDbCommandBuilder(MyODA)
        MyODA.InsertCommand = cmdBuilder.GetInsertCommand()
        MyODA.DeleteCommand = cmdBuilder.GetDeleteCommand()
        MyODA.UpdateCommand = cmdBuilder.GetUpdateCommand()
        MyODA.Fill(MyDs)
'---------更新子过程---------------------------------
        myDataView.DataSource = MyDs.Tables(0)
        If MyDs.HasChanges Then
            MyODA.Update(MyDs.Tables(0))
        End If

---------------------------------------------------------
以上代码,每当我在girdview里面用代码更改某单元格值时, 如果更新多条记录就能正常更新到数据库
要是代码只改了一条记录的话,就不能更新到数据库,请问有人碰到过这样的情况吗?怎么解决的?
--------------------编程问答-------------------- 修改单元格的值的代码贴出来看看。 --------------------编程问答-------------------- Maybe need to change mouse cursor to next record 
Because if you don't move mouse to next record, the record state would be changed to "modified".
So adpater is not awared that the record has been modifed. --------------------编程问答-------------------- 俺不是用你这方法做的,不是自动获取SQL语句
用的是DATASET,程序似乎没你这毛病
补充:.NET技术 ,  VB.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,