如何使用Sqldataadapter更新数据库 [英] How Do I Update A Database Using Sqldataadapter

查看:83
本文介绍了如何使用Sqldataadapter更新数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

'SQLDATAADAPTER
Dim sda As New SdaInvoice

'DATASET          
Dim InvDataSet As New InvoicesDataSet
        
  Dim builder As New SqlCommandBuilder(sda.SqlDataAdapter1)

          sda.SqlConnection1.ConnectionString = sda.SqlConnection1.ConnectionString
          sda.SqlConnection1.Open()

          sda.SqlDataAdapter1.Fill(InvDataSet.Invoice)
          builder.GetUpdateCommand()
          sda.SqlDataAdapter1.Update(InvDataSet.Invoice)
          InvDataSet.AcceptChanges()
          sda.SqlConnection1.Close()

          grdDetails.Enabled = False
          grpInvoice.Enabled = False

推荐答案

我找不到问题。他们没有错误。它没有更新!



嗯。

你有什么期望?

什么更新它需要做什么?填充和更新之间的数据没有变化 - 所以没有新的或改变的行,所以需要更改的总行数为零。



它不会更新那些不需要做任何事情的行!:笑:
"i can't find the problem. Their are no errors. It's not updating!"

Um.
What did you expect?
What updates does it need to do? There are no changes to the data between the Fill and the Update - so there are no new or altered rows, so the total rows that require changes is zero.

It's not going to update rows which don;t need anything done! :laugh:


这篇关于如何使用Sqldataadapter更新数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆