Allow nulls

M

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
 
J

James Jardine

Meelis Lilbok said:
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.
 
M

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
 
J

James Jardine

Meelis Lilbok said:
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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top