예제 #1
0
 private void TextChang(object sender, EventArgs e)
 {
     try
     {
         string            searchCode      = CB_searchCode.Text.Trim();
         string            selectSQL       = @"select goods.code,goods.name,unit.name  from goods,unit where goods.unit=unit.code and (goods.code like @searchCode  or goods.name like  @searchCode)";
         SQLiteParameter[] sQLiteParameter = new SQLiteParameter[1];
         sQLiteParameter[0] = new SQLiteParameter("@searchCode", "%" + searchCode + "%");
         DataTable goodsInfo;
         goodsInfo = sqlExecute.SelectInfo(sQLiteParameter, selectSQL);
         int j = goodsInfo.Rows.Count;
         if (j > 0)
         {
             CB_searchCode.Items.Clear();
             for (int a = 0; a < j; a++)
             {
                 CB_searchCode.Items.Add(goodsInfo.Rows[a]["code"] + "|" + goodsInfo.Rows[a]["name"] + "|" + goodsInfo.Rows[a]["name1"]);
             }
             CB_searchCode.Focus();
             CB_searchCode.Select(CB_searchCode.Text.Length, 0);
         }
         else
         {
             return;
         }
         this.CB_searchCode.DroppedDown = true;
         CB_searchCode.SelectedIndex    = -1;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return;
     }
 }
예제 #2
0
        public void SearchCodeChang(object sender, EventArgs args)
        {
            string searchCode  = CB_searchCode.Text.ToString().Trim();
            string selectBatch = @"select goodscode,goodsname from inorderdetail,instockorder where (goodscode like @searchcode or goodsname like @searchcode) and amount>0 and instockorder.status=1 and inorderdetail.status=1 and instockorder.ordercode=inorderdetail.ordercode order by createtime";

            SQLiteParameter[] sQLiteParameters = new SQLiteParameter[1];
            sQLiteParameters[0] = new SQLiteParameter("@searchcode", "%" + searchCode + "%");
            DataTable detailInfo;

            detailInfo = sqlExecute.SelectInfo(sQLiteParameters, selectBatch);
            int j = detailInfo.Rows.Count;

            if (j > 0)
            {
                CB_searchCode.Items.Clear();
                for (int a = 0; a < j; a++)
                {
                    CB_searchCode.Items.Add(detailInfo.Rows[a]["goodscode"] + "|" + detailInfo.Rows[a]["goodsname"] + "|");
                }
                CB_searchCode.Focus();
                CB_searchCode.Select(CB_searchCode.Text.Length, 0);
            }
            CB_searchCode.DroppedDown   = true;
            CB_searchCode.SelectedIndex = -1;
        }