Hi,

I have a composed primary key (2 fields) in a table and I have a child
who have the 2 fields as foreign key. I created an expression column in my 2
tables to combine my 2 primary key fields in one (Column1 + ' ' + Column2).
In my VB form, I did my DataBinding as follow (on a ComboBox) :


DataSource = myDataSet
DisplayMember = String field from my parent table
ValueMember = Expression column from my parent column
SelectedValue = Expression column from my child table (the actual one)


When I do a myDataSet.Tables(ChildTable).CancelChanges(), it don't cancel
the change I did in my ComboBox. It only works when I do my DataBinding on a
field that already exists in my DataBase (I always do my DataBinding on
primary keys).

Maybe there is a better way to do what I am trying to do, so let me know if
you have a better solution.

Thank you for your help.

Re: Expression column and DataBinding by Miha

Miha
Thu Jan 22 16:10:11 CST 2004

Hi,

I would avoid expressions as they are good only for readonly data IMO.
Rather, I would set values manually.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Sébastien" <igpnet@hotmail.com> wrote in message
news:%23%23F2LMT4DHA.2188@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I have a composed primary key (2 fields) in a table and I have a child
> who have the 2 fields as foreign key. I created an expression column in my
2
> tables to combine my 2 primary key fields in one (Column1 + ' ' +
Column2).
> In my VB form, I did my DataBinding as follow (on a ComboBox) :
>
>
> DataSource = myDataSet
> DisplayMember = String field from my parent table
> ValueMember = Expression column from my parent column
> SelectedValue = Expression column from my child table (the actual one)
>
>
> When I do a myDataSet.Tables(ChildTable).CancelChanges(), it don't cancel
> the change I did in my ComboBox. It only works when I do my DataBinding on
a
> field that already exists in my DataBase (I always do my DataBinding on
> primary keys).
>
> Maybe there is a better way to do what I am trying to do, so let me know
if
> you have a better solution.
>
> Thank you for your help.
>
>



Re: Expression column and DataBinding by Sébastien

Sébastien
Fri Jan 23 08:55:43 CST 2004

Thank you for your first answer.

Could you give me an example of what you mean ? Or just give me a little bit
more detail ?

Thank you.

"Miha Markic" <miha at rthand com> a écrit dans le message de
news:%23TAEEST4DHA.1868@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I would avoid expressions as they are good only for readonly data IMO.
> Rather, I would set values manually.
> --
> Miha Markic - RightHand .NET consulting & development
> miha at rthand com
> www.rthand.com
>
> "Sébastien" <igpnet@hotmail.com> wrote in message
> news:%23%23F2LMT4DHA.2188@TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > I have a composed primary key (2 fields) in a table and I have a
child
> > who have the 2 fields as foreign key. I created an expression column in
my
> 2
> > tables to combine my 2 primary key fields in one (Column1 + ' ' +
> Column2).
> > In my VB form, I did my DataBinding as follow (on a ComboBox) :
> >
> >
> > DataSource = myDataSet
> > DisplayMember = String field from my parent table
> > ValueMember = Expression column from my parent column
> > SelectedValue = Expression column from my child table (the actual one)
> >
> >
> > When I do a myDataSet.Tables(ChildTable).CancelChanges(), it don't
cancel
> > the change I did in my ComboBox. It only works when I do my DataBinding
on
> a
> > field that already exists in my DataBase (I always do my DataBinding on
> > primary keys).
> >
> > Maybe there is a better way to do what I am trying to do, so let me know
> if
> > you have a better solution.
> >
> > Thank you for your help.
> >
> >
>
>



Re: Expression column and DataBinding by Sébastien

Sébastien
Fri Jan 23 09:33:11 CST 2004

Ok, I understood what you meant and it work perfectly now.

If you know a better way to reach my goal without setting values manually,
please let me know, because I would not like my software to become slower
and slower each time I add more records in my database.

Thank you for your help.


"Miha Markic" <miha at rthand com> a écrit dans le message de
news:%23TAEEST4DHA.1868@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I would avoid expressions as they are good only for readonly data IMO.
> Rather, I would set values manually.
> --
> Miha Markic - RightHand .NET consulting & development
> miha at rthand com
> www.rthand.com
>
> "Sébastien" <igpnet@hotmail.com> wrote in message
> news:%23%23F2LMT4DHA.2188@TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > I have a composed primary key (2 fields) in a table and I have a
child
> > who have the 2 fields as foreign key. I created an expression column in
my
> 2
> > tables to combine my 2 primary key fields in one (Column1 + ' ' +
> Column2).
> > In my VB form, I did my DataBinding as follow (on a ComboBox) :
> >
> >
> > DataSource = myDataSet
> > DisplayMember = String field from my parent table
> > ValueMember = Expression column from my parent column
> > SelectedValue = Expression column from my child table (the actual one)
> >
> >
> > When I do a myDataSet.Tables(ChildTable).CancelChanges(), it don't
cancel
> > the change I did in my ComboBox. It only works when I do my DataBinding
on
> a
> > field that already exists in my DataBase (I always do my DataBinding on
> > primary keys).
> >
> > Maybe there is a better way to do what I am trying to do, so let me know
> if
> > you have a better solution.
> >
> > Thank you for your help.
> >
> >
>
>



Re: Expression column and DataBinding by Nauzad

Nauzad
Sat Jan 24 20:54:34 CST 2004

that depends on how you are doing it.

i would typically trap the "column_changed" event of the datatable for my
calculated columns.

regards,
Nauzad Kapadia [MVP]


"Sébastien" <igpnet@hotmail.com> wrote in message
news:%23ESN0Yc4DHA.2404@TK2MSFTNGP10.phx.gbl...
> Ok, I understood what you meant and it work perfectly now.
>
> If you know a better way to reach my goal without setting values manually,
> please let me know, because I would not like my software to become slower
> and slower each time I add more records in my database.
>
> Thank you for your help.
>
>
> "Miha Markic" <miha at rthand com> a écrit dans le message de
> news:%23TAEEST4DHA.1868@TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > I would avoid expressions as they are good only for readonly data IMO.
> > Rather, I would set values manually.
> > --
> > Miha Markic - RightHand .NET consulting & development
> > miha at rthand com
> > www.rthand.com
> >
> > "Sébastien" <igpnet@hotmail.com> wrote in message
> > news:%23%23F2LMT4DHA.2188@TK2MSFTNGP10.phx.gbl...
> > > Hi,
> > >
> > > I have a composed primary key (2 fields) in a table and I have a
> child
> > > who have the 2 fields as foreign key. I created an expression column
in
> my
> > 2
> > > tables to combine my 2 primary key fields in one (Column1 + ' ' +
> > Column2).
> > > In my VB form, I did my DataBinding as follow (on a ComboBox) :
> > >
> > >
> > > DataSource = myDataSet
> > > DisplayMember = String field from my parent table
> > > ValueMember = Expression column from my parent column
> > > SelectedValue = Expression column from my child table (the actual one)
> > >
> > >
> > > When I do a myDataSet.Tables(ChildTable).CancelChanges(), it don't
> cancel
> > > the change I did in my ComboBox. It only works when I do my
DataBinding
> on
> > a
> > > field that already exists in my DataBase (I always do my DataBinding
on
> > > primary keys).
> > >
> > > Maybe there is a better way to do what I am trying to do, so let me
know
> > if
> > > you have a better solution.
> > >
> > > Thank you for your help.
> > >
> > >
> >
> >
>
>