1

我有一个DataGridView并将我的查询添加到此,执行时我的查询会引发此错误:

新查询返回的架构与基本查询不同

这是我的查询:

        SELECT
               B.SettingKey, 'SysSettingsDep' AS TableName,
               B.SettingValue, B.SettingDesc
        FROM   SysCustomer AS A INNER JOIN
               SysSettingsDep AS B ON A.SettingKey = B.SettingKey
        UNION
        SELECT C.SettingKey, 'SysSettingsMachine' AS TableName,
               C.SettingValue, C.SettingDesc

        FROM    SysCustomer AS A INNER JOIN
                SysSettingsMachine AS C ON A.SettingKey = C.SettingKey
        UNION
        SELECT  D.SettingKey, 'SysSettings' AS TableName,
                D.SettingValue, D.SettingDesc
        FROM    SysCustomer AS A INNER JOIN SysSettings AS D ON
                A.SettingKey = D.SettingKey

帮我解决这个问题,

tnx

4

1 回答 1

0

很可能最初创建的 TableAdapter/DataTable 使用了不同的查询(基本查询),并且您正在使用的新查询似乎正在获取不同的结果模式,因此不匹配。

尝试为您的 DataSet 使用新的 TableAdapter 而不是旧的......

于 2012-10-13T15:54:37.507 回答