1. Create a DataSet object:
DataSet ds = new DataSet ("DatasetName");
2. View the structure created by calling Sqldataadapter.fill
Da. Fill (ds, "Orders");
DataTable tbl = ds. TABLE[0];
foreach (DataColumn col in tbl. Columns)
Console.WriteLine (Col. ColumnName);
3, view the data returned by SqlDataAdapter
①, DataRow objects
DataTable tbl = ds. TABLE[0];
DataRow row = tbl. ROW[0];
Console.WriteLine (ros["OrderID"]);
②, checking the data stored in DataRow
DataTable tbl = row. Table;
foreach (DataColumn col in tbl. Columns)
Console.WriteLine (Row[col]);
③, checking for DataRow objects in dattable
foreach (DataRow row in tbl. Rows)
DisplayRow (row);
4, verify the data in the dataset
①, validating DataColumn properties: Readonly,allowdbnull,maxlength,unique
Constrains collection of ②, DataTable objects: Uiqueconstraints,primarykey,foreignkeyconstraints
It is not usually necessary to create a foreignkeyconstraints, because one is created when a relationship is created between the two DataTable objects in the dataset.
③, using Sqldataadapter.fill mode to retrieve schema information