开发者

fill typed dataset by accessing columns directly?

I thought I can fill a typed dataset , which I created like this:

The name of the table is HouseInformation

In design mode I created a column NameOfHouse and Price.

Is it not possible to fill the columns directly? like...

dsWincObjects dsHouse = new dsWincObjects();
dsHouse.NameOfHouse = "value";

and and...

or option I thought...to instatiate the column

dsWincObjects.HouseInformationDataTable dtHouse = new dsWincObjects.HouseInformationDataTable();

Not Possible to acces directly the columns? and give my values to fill?

dtHouse.NameOfHous开发者_JAVA百科e = "value";....

Thanks

// edit

dsWincObjects dsMieter = new dsWincObjects();
            dsWincObjects.MieterInformationDataTable dtMieter = new dsWincObjects.MieterInformationDataTable();

            dsWincObjects.MieterInformationRow newRow = dtMieter.NewMieterInformationRow();
            newRow.FullName = "test";
            dsMieter.MieterInformation.AddMieterInformationRow(newRow);


You need to go row by row and add the information to the columns for each for.

DataTable HouseInformation = new DataTable("HouseInformation");
DataColumn colName = HouseInformation.Columns.Add("NameOfHouse");
DataColumn colPrice = HouseInformation.Columns.Add("Price");

// Add Data
DataRow newRow = HouseInformation.NewRow();
newRow[colName] = "Name of House 1";
newRow[colPrice] = 400000;
HouseInformation.Rows.Add(newRow);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜