kwh3856
asked on
Input string was not in a correct format
I am reading data from a table and and determined that one of the fields is a blank. My variable I am trying to store this data to is an integer. I am doing a Convert.ToInt32 but it does not know how to handle a blank field. I tried putting a .ToString at the end of the data but that did not work either. Can someone tell me the syntax to hand blank fields?
MyGlobalVars.initGuid = Guid.NewGuid();
myMPI.MPI1 = MyGlobalVars.initGuid;
myMPI.NPI = Convert.ToInt32(patient.d.NPI.ToString());-------- Error Here
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
reb's is the cleanest route, '??' means if the left side if it is not null, but if it is null, use the right side
ASKER
Reb,
Thank you very much.
Thank you very much.
myMPI.NPI = Convert.ToInt32(IIf(String
This will supply a default value (e.g., zero) if the field is blank.