Click here to Skip to main content
15,888,401 members
Home / Discussions / C#
   

C#

 
AnswerRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
kevinnicol3-Jan-12 3:46
kevinnicol3-Jan-12 3:46 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
__John_3-Jan-12 4:10
__John_3-Jan-12 4:10 
AnswerRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 4:18
Dan Mos3-Jan-12 4:18 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
__John_3-Jan-12 4:24
__John_3-Jan-12 4:24 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 4:26
Dan Mos3-Jan-12 4:26 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
__John_3-Jan-12 4:35
__John_3-Jan-12 4:35 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 4:41
Dan Mos3-Jan-12 4:41 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
__John_3-Jan-12 5:22
__John_3-Jan-12 5:22 
AnswerRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 7:08
Dan Mos3-Jan-12 7:08 
AnswerRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
PIEBALDconsult3-Jan-12 4:00
mvePIEBALDconsult3-Jan-12 4:00 
AnswerRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 4:31
Dan Mos3-Jan-12 4:31 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
__John_3-Jan-12 4:38
__John_3-Jan-12 4:38 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 4:44
Dan Mos3-Jan-12 4:44 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
__John_3-Jan-12 4:58
__John_3-Jan-12 4:58 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 5:06
Dan Mos3-Jan-12 5:06 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 4:53
Dan Mos3-Jan-12 4:53 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
__John_3-Jan-12 5:02
__John_3-Jan-12 5:02 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos3-Jan-12 5:09
Dan Mos3-Jan-12 5:09 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
__John_3-Jan-12 5:29
__John_3-Jan-12 5:29 
AnswerRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Luc Pattyn3-Jan-12 5:50
sitebuilderLuc Pattyn3-Jan-12 5:50 
GeneralRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
PIEBALDconsult4-Jan-12 13:41
mvePIEBALDconsult4-Jan-12 13:41 
QuestionRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Dan Mos7-Jan-12 12:07
Dan Mos7-Jan-12 12:07 
AnswerRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
PIEBALDconsult7-Jan-12 13:22
mvePIEBALDconsult7-Jan-12 13:22 
AnswerRe: OdbcDataReader calling IsDBNull changes the behaviour of Get methods Pin
Ennis Ray Lynch, Jr.3-Jan-12 7:41
Ennis Ray Lynch, Jr.3-Jan-12 7:41 
Your code changed. When you test things you should change 1 item at a time, however, you have also changed order and type. In your last example, you are calling GetString and GetInt32 on nColNumber which refers to an integer, your code should read:

int nameColumn = odbcDataReader.GetOrdinal(@"name");
int idColumn = odbcDataReader.GetOrdinal(@"iq");
while (odbcDataReader.Read()){
        odbcDataReader.IsDBNull(idColumn);
        int iqValue= odbcDataReader.GetInt32(idColumn);
        string nameValue = odbcDataReader.GetString(nameColumn );
}


I just typed it in the post window but you can see how different variable names make it easier to see.

Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS.

"And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

QuestionDeployment Pin
arkiboys3-Jan-12 2:52
arkiboys3-Jan-12 2:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.