0

将数据插入数据集的命令是什么?以下代码有什么问题:

DataSetReasons.Data_Tracker_RcodeDataTable GRX = 
    new DataSetReasons.Data_Tracker_RcodeDataTable();

DataSetReasons.Data_Tracker_RcodeRow rowx = 
    DataSetReasons.Data_Tracker_RcodeRow();

rowx.dtrc_id = 5;
rowx.eval_id = 28;
rowx.dtcr_StaffNum = "505651";
rowx.dtrc_RC1 = "C";
rowx.dtrc_RC2 = "A";
rowx.dtrc_RM1 = 2;
rowx.dtrc_RM2 = 4;

GRX.Rows.Add(rowx);
4

3 回答 3

0

用以下行替换您的代码:

DataSetReasons.Data_Tracker_RcodeRow rowx = GRX.NewRow();

关于将数据表添加到数据集,您必须创建一个数据集对象并将数据表添加到数据集。

于 2012-08-23T11:47:19.377 回答
0

您必须将数据表 GRX 添加到数据集 DataSetReasons。

   DataSetReasons.Data_Tracker_RcodeDataTable GRX = 
    new DataSetReasons.Data_Tracker_RcodeDataTable();

DataSetReasons.Data_Tracker_RcodeRow rowx = 
    DataSetReasons.Data_Tracker_RcodeRow();

rowx.dtrc_id = 5;
rowx.eval_id = 28;
rowx.dtcr_StaffNum = "505651";
rowx.dtrc_RC1 = "C";
rowx.dtrc_RC2 = "A";
rowx.dtrc_RM1 = 2;
rowx.dtrc_RM2 = 4;

GRX.Rows.Add(rowx);

    DataSetReasons.Tables.Add(GRX);//<--
于 2012-08-23T08:39:04.730 回答
0

解决了,谢谢大家...这是代码:

DataSetReasons.Data_Tracker_RcodeDataTable GRX =
new DataSetReasons.Data_Tracker_RcodeDataTable();

GRX.Rows.Add(13, 28, "C", 5, "A", 2, TextBox2.Text);
于 2012-08-26T08:34:18.930 回答