标题:导出SQL数据来计算
只看楼主
大头针
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2010-11-3
结帖率:75%
 问题点数:0 回复次数:0 
导出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));
      }
搜索更多相关主题的帖子: sql password command problem 
2011-02-10 23:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-332031-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015826 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved