Hi helper,
I have 2 tables as follows:
Product table:
Product_Num LabelType
1111 12
2222 23
3333 10
4444 22
etc....
Data Type table:
Id Product_Num Data_Type Data
1 1111 1 20.3
2 1111 2 33.6
3 1111 3 10
4 2222 1 15
etc....
I have 3 controlls on the form and I need them to be bind with 'Data' column of Data Type table.
Each text control should show different data according to the Data_Type value.
How can it be done???
I tried the following:
DataViewManager myDVM = new DataViewManager(dataSet);
foreach (DataViewSetting myDVS in myDVM.DataViewSettings)
myDVS.ApplyDefaultSort = true;
foreach (DataRow custRow in dataSet.Tables["Product"].Rows)
{
foreach (DataRow DataTypeRow in custRow.GetChildRows (Product_Data_Rel))
{
object DataResult = DataTypeRow["Data"];
object DataType = DataTypeRow["Data_type"];
Data_TypeNum=DataType.ToString();
myDVM.DataViewSettings["Data_Type"].Sort = "Data_type " + Data_TypeNum; //"1" or "2" or "3"
switch (Data_TypeNum)
{
case "1":
txtPrice1.DataBindings.Add ("Text",myDVM, "Data_Type.Data"
break;
case "2":
txtPrice2.DataBindings.Add("Text",myDVM, "Data_Type.Data"
break;
etc...
It links txtprices controlls with the first data only ('1111').
Product_Data_Rel - is the databinding between tables.
Please advise
Yossi
I have 2 tables as follows:
Product table:
Product_Num LabelType
1111 12
2222 23
3333 10
4444 22
etc....
Data Type table:
Id Product_Num Data_Type Data
1 1111 1 20.3
2 1111 2 33.6
3 1111 3 10
4 2222 1 15
etc....
I have 3 controlls on the form and I need them to be bind with 'Data' column of Data Type table.
Each text control should show different data according to the Data_Type value.
How can it be done???
I tried the following:
DataViewManager myDVM = new DataViewManager(dataSet);
foreach (DataViewSetting myDVS in myDVM.DataViewSettings)
myDVS.ApplyDefaultSort = true;
foreach (DataRow custRow in dataSet.Tables["Product"].Rows)
{
foreach (DataRow DataTypeRow in custRow.GetChildRows (Product_Data_Rel))
{
object DataResult = DataTypeRow["Data"];
object DataType = DataTypeRow["Data_type"];
Data_TypeNum=DataType.ToString();
myDVM.DataViewSettings["Data_Type"].Sort = "Data_type " + Data_TypeNum; //"1" or "2" or "3"
switch (Data_TypeNum)
{
case "1":
txtPrice1.DataBindings.Add ("Text",myDVM, "Data_Type.Data"
break;
case "2":
txtPrice2.DataBindings.Add("Text",myDVM, "Data_Type.Data"
break;
etc...
It links txtprices controlls with the first data only ('1111').
Product_Data_Rel - is the databinding between tables.
Please advise
Yossi