Char(1) column returning as string in DataTable

jayceepoo

Member
Joined
Jul 5, 2002
Messages
24
Location
Claremont, CA
I have a variable declared as a char that is going to hold a value in a table (for which the column is char(1)).

I populate a dataSet with that table, and I try to assign the value to the variable as:
Code:
cCriteriaTypeAbbrev = DirectCast(tblDetail.Rows(j).Item("CriteriaTypeAbbreviation"), Char)
But I get an invalid cast exception. I stepped through the code, and in the command window, i typed
? tblDetail.Rows(j).Item("CriteriaTypeAbbreviation"), and the command window said that it was a string variable?

Does anyone know why this is?

Thx for your time...
 
If you were to use a Strongly-typed dataset then your table would realize that it was of type Char, but in this case it will always be a String.
 
Back
Top