OleDbDataReader
-
Hi, I'm using a OleDbDataReader to get values from a MS Access db. I've noticed that if the db field is "null" I get an error, so I put in: myReader.IsDBNull (see code below). Is there a better way to code this null value protection? (besides forcing no nulls in db) - working with C# while (myReader.Read()) { if (myReader.IsDBNull(0) == false cost = myReader.GetDecimal(0); } thanks, Ron
-
Hi, I'm using a OleDbDataReader to get values from a MS Access db. I've noticed that if the db field is "null" I get an error, so I put in: myReader.IsDBNull (see code below). Is there a better way to code this null value protection? (besides forcing no nulls in db) - working with C# while (myReader.Read()) { if (myReader.IsDBNull(0) == false cost = myReader.GetDecimal(0); } thanks, Ron
what u used is the best method one more thing u can do ie cast the result to string now no error will come but its not correct. checking for null values and then assigning is the proper usage VMSSanthosh
-
what u used is the best method one more thing u can do ie cast the result to string now no error will come but its not correct. checking for null values and then assigning is the proper usage VMSSanthosh
thanks VMSSanthosh! Ron