By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

Determine the data type of a column

P: n/a
VS 2003, sql

How do you determine the data type of a column if its value is DBNull?

1)Table:
Column1 STRING non-nullable

2) Fill to a DataSet via DataAdapter

3) dim Data_Type_Is as object
Data_Type_Is = DataSet.DataTable(row1).column1??????????

I don't see how to get the data type. Things like gettype will give you the
type of the value, which would be DBNull if that is the value. I want to
get "STRING" back.

Please advise.

Bob Day

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You are trying to determine type of the specific value, not the column. The
column's type doesn't depend on the row, whereas the value may ..

I think this link should help you out...

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdatadatacolumnclassdatatypetopic.asp

HTH,

Bill
"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:#P*************@TK2MSFTNGP10.phx.gbl...
VS 2003, sql

How do you determine the data type of a column if its value is DBNull?

1)Table:
Column1 STRING non-nullable

2) Fill to a DataSet via DataAdapter

3) dim Data_Type_Is as object
Data_Type_Is = DataSet.DataTable(row1).column1??????????

I don't see how to get the data type. Things like gettype will give you the type of the value, which would be DBNull if that is the value. I want to
get "STRING" back.

Please advise.

Bob Day

Nov 20 '05 #2

P: n/a
No, you have got the question backwards.
The table already exists. I want to know the Data Type of the column, not
of the value in the column.
In other works, if the value in the column is <NULL>, then
column1.gettype.name produces "DBNull" even if it is defined as a STRING.
If the value is a string, then it does produce STRING.

Please advise.

Bob Day

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
You are trying to determine type of the specific value, not the column. The column's type doesn't depend on the row, whereas the value may ..

I think this link should help you out...

http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemdatadatacolumnclassdatatypetopic.asp

HTH,

Bill
"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:#P*************@TK2MSFTNGP10.phx.gbl...
VS 2003, sql

How do you determine the data type of a column if its value is DBNull?

1)Table:
Column1 STRING non-nullable

2) Fill to a DataSet via DataAdapter

3) dim Data_Type_Is as object
Data_Type_Is = DataSet.DataTable(row1).column1??????????

I don't see how to get the data type. Things like gettype will give you

the
type of the value, which would be DBNull if that is the value. I want to get "STRING" back.

Please advise.

Bob Day


Nov 20 '05 #3

P: n/a
Bob:

I know the table exists, so do the columns and rows. What's happening is
that you are checking the value you are checking against is the problem.
Both a given value and the Column as a whole have a Type. Did you check on
the link I posted? Look at this
then...http://www.informit.com/isapi/produc...2B-4BC0-B701-3
AEF1FD50913%7D/content/index.asp

Try this, Set the value to a string manually where you get DBNull right now.
It will change. It won't be dbnull anymore. That changes from Row to row.
The type of the value is different from the DBType of the column.

http://www.devarticles.com/art/1/118/4

HTH,,

Bill
"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:e7**************@TK2MSFTNGP11.phx.gbl...
No, you have got the question backwards.
The table already exists. I want to know the Data Type of the column, not
of the value in the column.
In other works, if the value in the column is <NULL>, then
column1.gettype.name produces "DBNull" even if it is defined as a STRING.
If the value is a string, then it does produce STRING.

Please advise.

Bob Day

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
You are trying to determine type of the specific value, not the column.

The
column's type doesn't depend on the row, whereas the value may ..

I think this link should help you out...

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdatadatacolumnclassdatatypetopic.asp

HTH,

Bill
"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:#P*************@TK2MSFTNGP10.phx.gbl...
VS 2003, sql

How do you determine the data type of a column if its value is DBNull?

1)Table:
Column1 STRING non-nullable

2) Fill to a DataSet via DataAdapter

3) dim Data_Type_Is as object
Data_Type_Is = DataSet.DataTable(row1).column1??????????

I don't see how to get the data type. Things like gettype will give
you
the
type of the value, which would be DBNull if that is the value. I want

to get "STRING" back.

Please advise.

Bob Day



Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.