表联接到一个数据集更新(仅要更新1个表) [英] Table Joins into one Dataset Update(Only want to update 1 table)

查看:110
本文介绍了表联接到一个数据集更新(仅要更新1个表)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我目前有一个数据集,其中包含来自4个独立表的数据.数据集包含来自4个表的数据的原因是为了使数据对读者更友好,即我有一个表,其中包含基于I.D.的描述.我还有另一个只包含ID的表格因此联接从我不想更新的表中获取描述,并将其插入到数据集中,以便用户可以选择描述,而不必关心ID.在给定
的情况下尝试更新数据集时遇到的问题

Hello,

I currently have a dataset which contains data from 4 separate tables. The reason the dataset contains data from the 4 tables is in order for the data to be more reader friendly i.e. I have a table which contains descriptions based off an I.D. and I have another table which just contains the I.D. so the join gets the description from the table that I do not want to update and inserts it into the dataset so the user can select the description and not have to care about the I.D. THe issue im running into is when attempting to update the dataset given the

adapter.SelectCommand = New OdbcCommand(query, conn)
        Dim builder As OdbcCommandBuilder = New OdbcCommandBuilder(adapter)



我显然收到一条错误消息,指出数据字段不匹配,即描述不是数字,因此不能作为I.D.输入.有谁知道我怎么可能告诉更新程序为I.D引用另一张表.



I am obviously getting an error stating that the datafields do not match i.e. the description isn''t a number and therefore can''t be entered as an I.D. Does anyone have any idea of how I could possibly tell the updater to reference the other table for the I.D. using the given description?

推荐答案

您将必须编写自己的SQL statemnet并自己构建SqlCommand对象.
CommandBuilder不会从包含任何JOIN的SELECT语句中构建UPDATE查询语句.
You''ll have to write you own SQL statemnet and build the SqlCommand object yourself.

The CommandBuilder will NOT build UPDATE query statements from SELECT statements that contains any kind of JOINs.


这篇关于表联接到一个数据集更新(仅要更新1个表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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