How to write data in data table
Posted: Tue Apr 26, 2016 11:07 pm
Hi Folks,
I have create a data table named xyz as a data source with 3 columns in it and one row with blank values. I want to assign values in row 1 of the data table for all 3 columns from my first test case where I am creating a user and I get values like userName, Password etc. Could you please tell me programatically how can I enter values in a data table.
I tried to do it this way:
Report.Info ("get data source");
var dataConn = DataSources.Get("DetailsTable");
//add rows to the data source with your specific data/values
Report.Info ("add rows with customized data to the data source");
dataConn.Rows[0].Values[0] = "32432fsf";
dataConn.Rows[0].Values[1] = "sdsadsads";
dataConn.Rows[0].Values[2] = "thgrfhh";
//DataSources.
//data source needs to be stored before used by the following Test Case
Report.Info ("store the data source");
dataConn.Store();
However I dont know what exactly I am missing as values are not being updated in the table.
Could you please guide?
I have create a data table named xyz as a data source with 3 columns in it and one row with blank values. I want to assign values in row 1 of the data table for all 3 columns from my first test case where I am creating a user and I get values like userName, Password etc. Could you please tell me programatically how can I enter values in a data table.
I tried to do it this way:
Report.Info ("get data source");
var dataConn = DataSources.Get("DetailsTable");
//add rows to the data source with your specific data/values
Report.Info ("add rows with customized data to the data source");
dataConn.Rows[0].Values[0] = "32432fsf";
dataConn.Rows[0].Values[1] = "sdsadsads";
dataConn.Rows[0].Values[2] = "thgrfhh";
//DataSources.
//data source needs to be stored before used by the following Test Case
Report.Info ("store the data source");
dataConn.Store();
However I dont know what exactly I am missing as values are not being updated in the table.
Could you please guide?