Home All Groups Group Topic Archive Search About
Author
20 Mar 2006 11:00 AM
Meelis Lilbok
Hi

How to get information from DataSet, allows the field NULL values or not?

If i fill DataSet and read
"MyDataSet.Tables("table").Columns("name").AllowDBNull"
then this returns always True


Regards;
Meelis

Author
20 Mar 2006 7:50 PM
James Jardine
Show quote Hide quote
"Meelis Lilbok" <meelis.lil***@deltmar.ee> wrote in message
news:eudJE2ATGHA.4600@TK2MSFTNGP11.phx.gbl...
> Hi
>
> How to get information from DataSet, allows the field NULL values or not?
>
> If i fill DataSet and read
> "MyDataSet.Tables("table").Columns("name").AllowDBNull"
> then this returns always True
>
>
> Regards;
> Meelis
>
>
How are you loading the schema for the data?  are you filling this from a
sql database or some fashion like that?   I think the problem is that no
schema is loaded so it doesn't know if AllowDBNull is true or false based on
the source table.
Author
21 Mar 2006 8:11 AM
Meelis Lilbok
Hi James

This "schema" thing is unknown for me :))

Im filling dataset from SQL database and then try to get DataType like this
MyDataSet.Tables("table").Columns("name").AllowDBNull


Meelis



Show quoteHide quote
"James Jardine" <james.jard***@geoage.com> wrote in message
news:%23YN1VeFTGHA.4452@TK2MSFTNGP12.phx.gbl...
>
> "Meelis Lilbok" <meelis.lil***@deltmar.ee> wrote in message
> news:eudJE2ATGHA.4600@TK2MSFTNGP11.phx.gbl...
>> Hi
>>
>> How to get information from DataSet, allows the field NULL values or not?
>>
>> If i fill DataSet and read
>> "MyDataSet.Tables("table").Columns("name").AllowDBNull"
>> then this returns always True
>>
>>
>> Regards;
>> Meelis
>>
>>
> How are you loading the schema for the data?  are you filling this from a
> sql database or some fashion like that?   I think the problem is that no
> schema is loaded so it doesn't know if AllowDBNull is true or false based
> on the source table.
>
Author
21 Mar 2006 1:13 PM
James Jardine
Show quote Hide quote
"Meelis Lilbok" <meelis.lil***@deltmar.ee> wrote in message
news:Om0pV8LTGHA.4752@TK2MSFTNGP10.phx.gbl...
> Hi James
>
> This "schema" thing is unknown for me :))
>
> Im filling dataset from SQL database and then try to get DataType like
> this
> MyDataSet.Tables("table").Columns("name").AllowDBNull
>
>
> Meelis
>
>
>
> "James Jardine" <james.jard***@geoage.com> wrote in message
> news:%23YN1VeFTGHA.4452@TK2MSFTNGP12.phx.gbl...
>>
>> "Meelis Lilbok" <meelis.lil***@deltmar.ee> wrote in message
>> news:eudJE2ATGHA.4600@TK2MSFTNGP11.phx.gbl...
>>> Hi
>>>
>>> How to get information from DataSet, allows the field NULL values or
>>> not?
>>>
>>> If i fill DataSet and read
>>> "MyDataSet.Tables("table").Columns("name").AllowDBNull"
>>> then this returns always True
>>>
>>>
>>> Regards;
>>> Meelis
>>>
>>>
>> How are you loading the schema for the data?  are you filling this from a
>> sql database or some fashion like that?   I think the problem is that no
>> schema is loaded so it doesn't know if AllowDBNull is true or false based
>> on the source table.
>>
>
>

You have to call the FillSchema method of your dataadapter before you call
your .Fill.  This will fetch the allowDbNull information from the database.
Of course.. this increases the number of trips to the database but if you
need the information this is how you get it.
http://msdn2.microsoft.com/en-US/library/229sz0y5(VS.80).aspx   this link is
to 2005 but it is the same concept as 2003 and 2002.