Input string was not in acorrect format
Hi Everyone,
I was wondering if someone could help me. I am trying to get the value of a parameter from a stored procedure. I keep getting the error "Input string was not in a correct format.". It looks like it is in the correct format to me. Any suggestions?
Here's the code that gets the error.....
customer.id=convert.toint32(rd[0].tostring)
where rd is a sql dataReader
read from the stored procedure
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

frostyraver20 reputationPosted Apr 21, 2009, 7:20 AM EDT
customer.id <= is this customer id an int?
=convert.toint32(rd[0].tostring) <= your trying to convert an array of customer ids to an int?
I'm not sure elaborate on this subject. If your seeing this message it's because you have a string value somewhere, you might need more converts or something.
sara khatib3 reputationPosted Apr 21, 2009, 7:42 AM EDT
frostyraver20 reputationPosted May 16, 2009, 6:42 PM EDT
// If there is selected items do this
if (lisbox.items.selected != null)
{
// Code for your program here if the listbox is selected
}
// If there are no items selected then display this
else
{
// Error display code here
}
You could maybe set up an error checker that way?