|
楼主 |
发表于 2013-10-11 14:32:19
|
显示全部楼层
最后还是选择sql直接访问的方法解决了,谢谢大家!
int[] Count = new int[23];
string SqlStr="Data Source=shaw\\shaw;Database=datagraphic;Uid=sawd=403405;";
SqlConnection con = new SqlConnection(SqlStr);
con.Open();
string cmdtxt="SELECT *FROM datagraphic WHERE SUM>0";
SqlDataAdapter da = new SqlDataAdapter(cmdtxt,con);
DataSet ds = new DataSet();
da.Fill(ds);
for (int i = 0; i < 23; i++)
{
if(ds.Tables[0].Rows.Count==0)
{
Count[i]=0;
}
else
{
Count[i]=Convert.ToInt32(ds.Tables[0].Rows[i][1].ToString());
}
}
GridView1.DataSource = Count;
GridView1.DataBind();
con.Close(); |
|