c#如何禁止textbox录入时自动查询数据
privatevoidbutton1_Click(objectsender,EventArgse){DateTimeZz=Convert.ToDateTime(dateT...
private void button1_Click(object sender, EventArgs e)
{
DateTime Zz = Convert.ToDateTime(dateTimePicker1.Text);
DateTime dt2 = Convert.ToDateTime(dateTimePicker2.Text);
string r1 = Zz.ToString("yyyy-MM-dd");
string r2 = dt2.ToString("yyyy-MM-dd");
string fbillno = this.Sebillno.Text.Trim();
string fnumber = this.ItemNo.Text.Trim();
string khname = this.CustName.Text.Trim();
string ZT = Fstatus.Text.ToString();
ZT = Fstatus.Text;
string yj;
string yj2 = "select a.fdate as '日期',a.fbillno as '销售订单号',case when a.FClosed=0 then '未关闭' when a.FClosed=1 then '关闭' end as '是否关闭'," +
"b.FEntrySelfS0162 as '客户订单号',c.fname as '客户名称',d.fnumber as '产品代码',b.FEntrySelfS0168 as '产品名称',d.fmodel as '规格型号', \n\r " +
"convert(decimal(10,0),b.FAuxQty) as '数量',convert(decimal(10,0),b.fstockqty) as '出货数量',convert(decimal(10,0),b.FAuxQty-b.fstockqty) as '未出货数量'," +
"c2.fname as '海外客户',b.FEntrySelfS0160 as '客户下单日期',b.Fdate as '客户交期', \n\r " +
"e.FName as '业务员',b.fentryid as '订单分录',b.finterid from seorder a \n\r " +
"left join seorderentry b on b.finterid=a.finterid \n\r " +
"left join t_icitem d on d.fitemid=b.fitemid \n\r " +
"left join t_Organization c on c.fitemid=a.fcustid \n\r " +
"left join t_Organization c2 on c2.fitemid=a.FHeadSelfS0151 \n\r " +
"left join t_Emp e on e.fitemid=a.FEmpID where a.FCheckDate >= '" + r1 + "' and a.fcheckdate <= '" + r2 + "' " +
"and a.fbillno like '%" + Sebillno.Text.Trim() + "%'" +
"and d.fnumber like '%" + ItemNo.Text.Trim() + "%'" +
"and c.fname like '%" + CustName.Text.Trim() + "%' and a.fcancellation=0 ";
if (ZT == "全部")
{
yj = yj2;
}
else
{
if (ZT == "关闭")
{
yj = yj2 + " and a.FClosed=1 ";
}
else
{
if (ZT == "未关闭")
{
yj = yj2 + " and a.FClosed=0 ";
}
else
{
yj = yj2;
}
}
}
SqlConnection myconn = new SqlConnection(this.tosql.sqlconn2);
SqlDataAdapter da = new SqlDataAdapter(yj, myconn);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
label1.Text = "共有" + ds.Tables[0].Rows.Count + "条查询记录"; 展开
{
DateTime Zz = Convert.ToDateTime(dateTimePicker1.Text);
DateTime dt2 = Convert.ToDateTime(dateTimePicker2.Text);
string r1 = Zz.ToString("yyyy-MM-dd");
string r2 = dt2.ToString("yyyy-MM-dd");
string fbillno = this.Sebillno.Text.Trim();
string fnumber = this.ItemNo.Text.Trim();
string khname = this.CustName.Text.Trim();
string ZT = Fstatus.Text.ToString();
ZT = Fstatus.Text;
string yj;
string yj2 = "select a.fdate as '日期',a.fbillno as '销售订单号',case when a.FClosed=0 then '未关闭' when a.FClosed=1 then '关闭' end as '是否关闭'," +
"b.FEntrySelfS0162 as '客户订单号',c.fname as '客户名称',d.fnumber as '产品代码',b.FEntrySelfS0168 as '产品名称',d.fmodel as '规格型号', \n\r " +
"convert(decimal(10,0),b.FAuxQty) as '数量',convert(decimal(10,0),b.fstockqty) as '出货数量',convert(decimal(10,0),b.FAuxQty-b.fstockqty) as '未出货数量'," +
"c2.fname as '海外客户',b.FEntrySelfS0160 as '客户下单日期',b.Fdate as '客户交期', \n\r " +
"e.FName as '业务员',b.fentryid as '订单分录',b.finterid from seorder a \n\r " +
"left join seorderentry b on b.finterid=a.finterid \n\r " +
"left join t_icitem d on d.fitemid=b.fitemid \n\r " +
"left join t_Organization c on c.fitemid=a.fcustid \n\r " +
"left join t_Organization c2 on c2.fitemid=a.FHeadSelfS0151 \n\r " +
"left join t_Emp e on e.fitemid=a.FEmpID where a.FCheckDate >= '" + r1 + "' and a.fcheckdate <= '" + r2 + "' " +
"and a.fbillno like '%" + Sebillno.Text.Trim() + "%'" +
"and d.fnumber like '%" + ItemNo.Text.Trim() + "%'" +
"and c.fname like '%" + CustName.Text.Trim() + "%' and a.fcancellation=0 ";
if (ZT == "全部")
{
yj = yj2;
}
else
{
if (ZT == "关闭")
{
yj = yj2 + " and a.FClosed=1 ";
}
else
{
if (ZT == "未关闭")
{
yj = yj2 + " and a.FClosed=0 ";
}
else
{
yj = yj2;
}
}
}
SqlConnection myconn = new SqlConnection(this.tosql.sqlconn2);
SqlDataAdapter da = new SqlDataAdapter(yj, myconn);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
label1.Text = "共有" + ds.Tables[0].Rows.Count + "条查询记录"; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询