导出SQL数据来计算
Hi, here is my code. and it seems that the problem is the format of the output from the sql command. it is not float but a string or what. how can I fix this problem??? many thanks.SqlConnection myConnection = new SqlConnection("user id=ABC; password=123; Trusted_Connection=yes; Data Source=ABCD\\SQLEXPRESS; Database=MyDb");
SqlCommand myCommand = new SqlCommand("SELECT Col1, Col2 FROM MyTable", myConnection);
myConnection.Open();
SqlDataReader myReader= null;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Chart1.Series["Series1"].Points.AddY(myReader.GetFloat(0));
Chart1.Series["Series2"].Points.AddY(myReader.GetFloat(1));
}