D
dm_dal
I have a typed dataset with two tables ( Table1 and Table2 ). I'm not
trying to update the actual db tables at this point, just wanting to see the
results in the DataGrid.
Column are:
Table1.ID (int)
Table1.cell1 (string)
Table1.cell2 (string)
Table1.cell3 (string)
Table2.ID (int)
Table2.cell1 (string)
Table2.data1 (string)
Table2.data2 (string)
Table2.data3 (string)
The keys for both tables are the ID column and the cell1 column. and a
parent/child relationship is defined, with Table1 as the parent and Table2
as the child. The UpdateRule is set to "Cascade".
When I insert a new row into Table1, I would expect that a new row is
inserted into Table2, with the parent column values from the ID and cell 1
columns propogated to Table2, but, when I check Table2, there are no rows.
Here's the code:
public class WebForm1 : System.Web.UI.Page
{
protected DAL.TestDataSet ds;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
InitDataSet();
BindGrid();
}
private void InitDataSet()
{
ds = new DAL.TestDataSet();
DAL.TestDataSet.TABLE1Row row = ds.TABLE1.AddTABLE1Row(30,"data 1","data
2","data 3");
ds.AcceptChanges();
}
private void BindGrid()
{
DataGrid1.DataSource = ds.TABLE2;
DataGrid1.DataBind();
}
trying to update the actual db tables at this point, just wanting to see the
results in the DataGrid.
Column are:
Table1.ID (int)
Table1.cell1 (string)
Table1.cell2 (string)
Table1.cell3 (string)
Table2.ID (int)
Table2.cell1 (string)
Table2.data1 (string)
Table2.data2 (string)
Table2.data3 (string)
The keys for both tables are the ID column and the cell1 column. and a
parent/child relationship is defined, with Table1 as the parent and Table2
as the child. The UpdateRule is set to "Cascade".
When I insert a new row into Table1, I would expect that a new row is
inserted into Table2, with the parent column values from the ID and cell 1
columns propogated to Table2, but, when I check Table2, there are no rows.
Here's the code:
public class WebForm1 : System.Web.UI.Page
{
protected DAL.TestDataSet ds;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
InitDataSet();
BindGrid();
}
private void InitDataSet()
{
ds = new DAL.TestDataSet();
DAL.TestDataSet.TABLE1Row row = ds.TABLE1.AddTABLE1Row(30,"data 1","data
2","data 3");
ds.AcceptChanges();
}
private void BindGrid()
{
DataGrid1.DataSource = ds.TABLE2;
DataGrid1.DataBind();
}