Hi,
I am getting this exception System.InvalidCastException: Specified cast is not valid in the following code :
if (type == "in")
{
config.AppSettings.Settings["HasMoney"].Value = "True";
long ttype = 0;
long value = 0;
int quantity = 0;
for (int i =1 ; i<=7;i++)
{
ttype = 0;
value = 0;
quantity = 0;
switch(i)
{
case 1:
ttype = 5;
break;
case 2:
ttype = 10;
break;
case 3:
ttype = 20;
break;
case 4:
ttype = 50;
break;
case 5:
ttype = 100;
break;
case 6:
ttype = 200;
break;
case 7:
ttype = 500;
break;
}
quantity = rd.GetInt32(i+7);
value = quantity * ttype;
if(quantity !=0)
I am getting this error in quantity = rd.GetInt32(i+7)and in my database the value is of type int only. So why am i getting this error.
Gunjan MananPosted Jun 25, 2015, 10:01 AM
Upendra Pratap ShahiPosted Jun 25, 2015, 7:38 AM