Re: DataReader.GetInt.....
the cast error means the column is not a numeric column or null. if its
a string then you can parse it.
int i = int.Parse(datareader.GetString(0);
-- bruce (sqlwork.com)
mavrick_101 wrote:
Hi,
How can I get value of a SQL column defined as int.
I try
int myInt = dataReader.GetInt32(0);
I get invalid cast exception and same for
GetInt16...
whats the best way?
Thnx
.
Relevant Pages
- Re: Give me an Int
... > int.Parse(), Convert.ToInt32or casting to int? ... If from a string, its better to Parse ... (microsoft.public.dotnet.languages.csharp) - Re: dynamic array of ints
... > need to parse them out and put them in an array. ... > are there and thus don't know how large to make my array. ... > sure what to use to read the ints from the string. ... read_ints(FILE *stream, int n, int *how_many) ... (comp.programming) - Interesting Integer.parseInt() problem
... I'm working on a project where I'm being given a string of 0s and 1s and need to mask them against another string of the same. ... You can't parse out 32 bits to an int if the MSB is 1. ... (comp.lang.java.programmer) - Re: parsing a string into substring and integers
... Peter Nilsson wrote: ... string into components? ... int calendar_year; ... What would need to happen after the parse is this: ... (comp.lang.c) - Re: How to get a part of a string using reg exp
... Get the substring, parse it to an int, increment it, then turn it back into ... a string and put it back in. ... (microsoft.public.dotnet.languages.csharp) |
|