Hi Charlie,
The datatable is the one returned from this method:
http://msdn2.microsoft.com/en-us/library/system.data.common.dbdatasourceenumerat
or.getdatasources.aspx
> I don't know which .net method you are referring to, but you should still be
> able to control the SELECT statement. The DataAdapter would be the most
[quoted text clipped - 28 lines]
> > > > it so the new column will get the value of the other column even the other
> > > > column is system.dbnull?
Armin Zingler - 01 Oct 2007 22:34 GMT
> Hi Charlie,
>
> The datatable is the one returned from this method:
> http://msdn2.microsoft.com/en-us/library/system.data.common.dbdatasourceenumerat
or.getdatasources.aspx
I do not completely understand the problem. I see, you are getting this
datatable returned. Now, you want to add another column. You say, the
problem is that there might be NULL values. Why is this a problem? What does
the value of the new column have to be?
Armin
Peter - 01 Oct 2007 23:34 GMT
Hi Armin,
I add the new column based on existing columns. If one of the based columns
contains null (dbnull), the new column will contain null regardless the value
in other based columns.
> > Hi Charlie,
> >
[quoted text clipped - 7 lines]
>
> Armin
Armin Zingler - 02 Oct 2007 00:04 GMT
> Hi Armin,
>
> I add the new column based on existing columns. If one of the based
> columns contains null (dbnull), the new column will contain null
> regardless the value in other based columns.
What is a "column based on existing columns"?
Armin
Peter - 02 Oct 2007 02:58 GMT
Hi Armin,
What I mean is the value of the new column will have the combined value of
existing columns I specified using datatable.columns.add().
> > Hi Armin,
> >
[quoted text clipped - 5 lines]
>
> Armin
Armin Zingler - 02 Oct 2007 03:10 GMT
> Hi Armin,
>
> What I mean is the value of the new column will have the combined
> value of existing columns I specified using datatable.columns.add().
What's a "combined value"? Sorry for asking if that's too obvious.
>> > Hi Armin,
>> >
[quoted text clipped - 5 lines]
>>
>> Armin
Peter - 02 Oct 2007 03:22 GMT
The value of the new column will simply be the value of columnX + the value
of columnY. This is simply done by issuing datatable.columns.add().
However, the value of the new column will be null if either one of the
columns is null.
> > Hi Armin,
> >
[quoted text clipped - 14 lines]
> >>
> >> Armin
Armin Zingler - 02 Oct 2007 04:54 GMT
> The value of the new column will simply be the value of columnX +
> the value of columnY. This is simply done by issuing
> datatable.columns.add(). However, the value of the new column will
> be null if either one of the columns is null.
Ok, but how do you calculate the values in the column? The sum must be put
into the rows at any time.
> > > Hi Armin,
> > >
[quoted text clipped - 14 lines]
> > > >
> > > > Armin
Cor Ligthert[MVP] - 02 Oct 2007 05:35 GMT
Peter,
What Armin probably asks is. Show that piece of code that you are using. It
seems that people is afraid to show that here, why we don't understand,
because really you are not showing secrets or your own inventions with that.
We are not forever asking direct questions here in this newsgroup, however I
know that Armin often asks, "Show us a piece of your code".
:-)
Cor
Charlie - 01 Oct 2007 23:29 GMT
You could write a function that takes a single parameter--Datatable (the one
returned by GetDataSources). In the function, create a new datatable (that
will be the return value) and populate it in nested loops using the values
from the GetDataSources datatable. In the second loop you would combine the
columns you want to combine into a single column. That's where you could
test for isdbnull.
> Hi Charlie,
>
[quoted text clipped - 33 lines]
> > > > > it so the new column will get the value of the other column even the other
> > > > > column is system.dbnull?