Allow nulls

  • Thread starter Thread starter Meelis Lilbok
  • Start date Start date
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
 
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.
 
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
 
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.
 
Back
Top