来自' DateTime'的无效广播到' Int32' .Couldn&t;存储< 2/14/2013 12:00:00 AM>在专栏中。预期的类型是C#中的Int32

时间:2013-04-01 08:06:34

标签: c# asp.net sql-server-2008

如何解决这个问题?我是ASP.Net的新手 这是我的代码:

try
    {
        cmd.Connection = con;
        if (cmd.Connection.State == ConnectionState.Open)
        {
            cmd.Connection.Close();
        }
        else
        {
            con.Open();
        }
        cmd.CommandText = "SELECT " + Dd_List.SelectedValue.ToString() + "," + Dd_ListY.SelectedValue.ToString() + " FROM " + DropDownList3.SelectedValue.ToString()  + " WHERE " + dd_equal_to_First_Cond.SelectedValue.ToString()  + " BETWEEN '" + txtDateFrom.Text.ToString()  + "' AND '" + txtDateTo.Text.ToString()  + "' ";
        Response.Write(cmd.CommandText);
        da.SelectCommand = cmd;
        da.Fill(ds);
        Chart1.DataSource = ds;
        Chart1.Legends.Add("Inspection_Date").Title = "Inspection_Date";
        Chart1.ChartAreas["ChartArea1"].AxisX.Title = Dd_List.SelectedValue;
        Chart1.ChartAreas["ChartArea1"].AxisY.Title = Dd_ListY.SelectedValue;
        Chart1.Series["Series1"].XValueMember = Dd_List.SelectedValue;
        Chart1.Series["Series1"].YValueMembers = Dd_ListY.SelectedValue;
        Chart1.DataBind();

    }

0 个答案:

没有答案