A
Adik
Hi,
I've got a problem with the DataBindings. I've got a form with 3
textboxes and also one DataGrid which shows the details for the the
current record.
I've got a DataSet with two tables in it (Master/Details). I created
primary keys and set a relation between those two tables. In Addition
i bound the three textboxes to the master-table.
My problem is: If i now want to change the current record using the
BindingContext it only works for the textboxes but my DataGrid still
shows the first record which was loaded when the form loaded :-(
Please check my code before i get sick of this problem...
public void addproducts()
{
OleDbCommand SelCom = new OleDbCommand("Select * from
tab_products", con.getCon());
productsadapter.SelectCommand = selCom;
OleDbCommand selDetails = new OleDbCommand("Select * from
tab_prices", con.getCon());
detailsadapter.SelectCommand = selDetails;
productsadapter.Fill(ds, "tab_products");
detailsadapter.Fill(ds,"tab_prices");
ds.Relation.Add("productdetails",ds.Tables["tab_products"].Columns["PRD_Nr",
ds.Tables["tab_prices"].Columns["ARP_PRDNr"]);
dgd_details.DataSource = ds;
dgd_details.DataMember = "tab_prices.productdetails";
this.txt_nr.DataBindings.Add("text,ds.Tables["tab_products"],"PRD_Nr");
this.txt_description.DataBindings.Add("text,ds.Tables["tab_products"],"PRD_Description");
this.txt_info.DataBindings.Add("text,ds.Tables["tab_products"],"PRD_Info");
this.BindingContext[ds.Tables["tab_products"]].Position
= 5;
}
Thanks for u support!
Christoph
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
I've got a problem with the DataBindings. I've got a form with 3
textboxes and also one DataGrid which shows the details for the the
current record.
I've got a DataSet with two tables in it (Master/Details). I created
primary keys and set a relation between those two tables. In Addition
i bound the three textboxes to the master-table.
My problem is: If i now want to change the current record using the
BindingContext it only works for the textboxes but my DataGrid still
shows the first record which was loaded when the form loaded :-(
Please check my code before i get sick of this problem...
public void addproducts()
{
OleDbCommand SelCom = new OleDbCommand("Select * from
tab_products", con.getCon());
productsadapter.SelectCommand = selCom;
OleDbCommand selDetails = new OleDbCommand("Select * from
tab_prices", con.getCon());
detailsadapter.SelectCommand = selDetails;
productsadapter.Fill(ds, "tab_products");
detailsadapter.Fill(ds,"tab_prices");
ds.Relation.Add("productdetails",ds.Tables["tab_products"].Columns["PRD_Nr",
ds.Tables["tab_prices"].Columns["ARP_PRDNr"]);
dgd_details.DataSource = ds;
dgd_details.DataMember = "tab_prices.productdetails";
this.txt_nr.DataBindings.Add("text,ds.Tables["tab_products"],"PRD_Nr");
this.txt_description.DataBindings.Add("text,ds.Tables["tab_products"],"PRD_Description");
this.txt_info.DataBindings.Add("text,ds.Tables["tab_products"],"PRD_Info");
this.BindingContext[ds.Tables["tab_products"]].Position
= 5;
}
Thanks for u support!
Christoph
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*