无法将DataRow添加到DataSet

时间:2015-08-18 12:47:38

标签: sql vb.net

更新

我把它放在Try Catch中并且还尝试了下面的代码,我得到一个Exception和Exception Message声明,“当IDENTITY_INSERT设置为OFF时,不能在表'CUsers'中为identity列插入显式值。”我不是要在Identity Column中插入任何内容。我把它设置为自动增量。

不确定该怎么做。

CUsersTableAdapter.Fill(MasterDataSet.CUsers)

Dim AddRow As MasterDataSet.CUsersRow
AddRow = MasterDataSet.CUsers.NewCUsersRow

AddRow.UserFirst = "Test"
AddRow.UserLast = "Testing"
AddRow.UserEmail = "Test@Email.com"
AddRow.UserPhone = "555-555-5555"
AddRow.UserWorkCenter = 482126468
AddRow.UserRole = 908977894
AddRow.MergeID = 739809237

MasterDataSet.CUsers.Rows.Add(AddRow)

CUsersTableAdapter.Update(MasterDataSet.CUsers)

2 个答案:

答案 0 :(得分:2)

您无法将library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity counter8bit is port(CLKDA, CLKLD : in std_logic; D : in std_logic_vector(7 downto 0); Q : out std_logic_vector(7 downto 0)); end counter8bit; architecture archi of counter8bit is signal tmp: std_logic_vector(7 downto 0); begin process (CLKDA, CLKLD, D) begin if (CLKLD'event and CLKLD='0') then tmp <= D; elsif (CLKDA'event and CLKDA='1') then tmp <= tmp + 1; end if; end process; Q <= tmp; end archi; 添加到DataRow,但您可以将其添加到DataSet中的任何表中,因此请执行以下操作:

DataSet

答案 1 :(得分:0)

MasterDataSet.Tables(0).AddRows(newRow)