SupplyManage.cpp
上传用户:tangpei45
上传日期:2013-07-14
资源大小:9104k
文件大小:2k
源码类别:

百货/超市行业

开发平台:

C++ Builder

  1. //----------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "SupplyManage.h"
  5. //----------------------------------------------------------------------------
  6. #pragma resource "*.dfm"
  7. TfmSupplyManage *fmSupplyManage;
  8. //----------------------------------------------------------------------------
  9. __fastcall TfmSupplyManage::TfmSupplyManage(TComponent *Owner)
  10. : TForm(Owner)
  11. {
  12. }
  13. //----------------------------------------------------------------------------
  14. void __fastcall TfmSupplyManage::FormCreate(TObject *Sender)
  15. {
  16. Table1->Open();
  17.     // 上一窗体我们再窗体中设置下拉设计辞典
  18.     // 本窗体在程序中创建,并从数据库中读取出辞典
  19.     TQuery* pQuery = new TQuery(NULL);
  20.     pQuery->DatabaseName = "db";
  21.     pQuery->SQL->Add("select 姓名 from 业务员清单");
  22.     pQuery->Open();
  23.     TColumn *pCol = DBGrid1->Columns->Items[3];
  24.     // 添加列表项
  25.     while(!pQuery->Eof)
  26.     {
  27.         pCol->PickList->Add(pQuery->FieldByName("姓名")->AsString);
  28.         pQuery->Next();
  29.     }
  30.     // 释放空间
  31.     delete pQuery;
  32. }
  33. //----------------------------------------------------------------------------
  34. void __fastcall TfmSupplyManage::FormClose(TObject *Sender,
  35.       TCloseAction &Action)
  36. {
  37.   // 删除窗体并回收空间
  38.     Action = caFree;
  39. }
  40. //---------------------------------------------------------------------------
  41. void __fastcall TfmSupplyManage::Button1Click(TObject *Sender)
  42. {
  43.     Table1->Filtered = false;
  44.     // 设置table控件的filter属性
  45.     // 可以起到查询条件的作用
  46.     if(Edit1->Text.Length()==0)
  47.         Table1->Filter = "";
  48.     else
  49.         Table1->Filter = " 拼音编码 = '" + Edit1->Text + "*'";
  50.     Table1->Filtered = true;
  51. }
  52. //---------------------------------------------------------------------------
  53. void __fastcall TfmSupplyManage::DBGrid1DblClick(TObject *Sender)
  54. {
  55.     if(m_Input)
  56.     {
  57.         m_szSelectCode = Table1->FieldByName("供货商号")->AsString;
  58.         this->Close();
  59.     }
  60. }
  61. //---------------------------------------------------------------------------