3
Answers

String was in a correct format

saifullah khan

saifullah khan

13y
3.4k
1
i have some error in code and i dont understand how to remove it.
double f,g;
string a,b;
con.Open();
cmd = new SqlCommand("select MAX (high) FROM DailyChange WHERE Symbol='" + Currency.SelectedValue.ToString() + "' AND Date='" + Label2.Text + "'", con);
a = cmd.ExecuteScalar().ToString();
f = Convert.ToDouble(a);
Response.Write(f);
con.Close();
con.Open();
cmd = new SqlCommand("select MAX (high) FROM DailyChange WHERE Symbol='" + Currency.SelectedValue.ToString() + "' AND Date='" + Label3.Text + "'", con);
b = cmd.ExecuteScalar().ToString();
 
g = Convert.ToDouble(b);
Response.Write(g);
con.Close();
It gives me the following error:
Input string was not in a correct format.
Line 81: g = Convert.ToDouble(b);
Answers (3)