a = reader("Date")
b = reader("Time")
a = Convert.ToInt32(reader(Convert.ToInt32(a)))
b = Convert.ToInt32(reader(Convert.ToInt32(b)))
StrSql.Parameters.AddWithValue("@a", Convert.ToDouble(a))
StrSql.Parameters.AddWithValue("@b", Convert.ToDouble(b))
All throughout the above code, you are trying to convert extracted values of
a
&
b
Based on the field names (& error you get), it looks like values of
a
&
b
are of DateTime type. Since the data extracted is of Date type, you get an error when you try to convert it into double.
Options:
1. Get the data in format you want.
2. change your
strSql
that expects double, pass dates to it and modify it to accept dates instead of double.