为什么DataSet 的值是空??
public partial class Report1 : System.Web.UI.Page
{
DataSet ds = new DataSet();
protected void btn_find_Click(object sender, EventArgs e)
{
string strconn = ConfigurationManager.AppSettings[ "dsn "];
//连接本地计算机的WMS数据库
SqlConnection cn = new SqlConnection(strconn);
string mysql = "SELECT a.vin, d.name AS operate, a.operate_time, a.warehouse, b.name AS driver, c.name AS operator FROM Transations a INNER JOIN Drivers b ON a.driver = b.code INNER JOIN Users c ON a.operator = c.Uname INNER JOIN TransationCode d ON a.operate = d.code where (operate= 'movein ') ";
//如果仓库有输入
if (ddl_warehouse.SelectedIndex != 0)
{
mysql = mysql + "and a.warehouse= ' " + ddl_warehouse.SelectedItem.Text.ToString() + " ' ";
}
if (tbx_time1.Text.ToString() != " ")
{
mysql = mysql + "and a.operate_time> = ' " + tbx_time1.Text.ToString() + " ' ";
}
if (tbx_time2.Text.ToString() != " ")
{
mysql = mysql + "and a.operate_time <= ' " + tbx_time2.Text.ToString() + " ' ";
}
mysql = mysql + " ORDER BY a.operate_time ";
SqlDataAdapter da = new SqlDataAdapter(mysql, cn);
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
cn.Close(); <