SupplyManage.cpp
上传用户:tangpei45
上传日期:2013-07-14
资源大小:9104k
文件大小:2k
- //----------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "SupplyManage.h"
- //----------------------------------------------------------------------------
- #pragma resource "*.dfm"
- TfmSupplyManage *fmSupplyManage;
- //----------------------------------------------------------------------------
- __fastcall TfmSupplyManage::TfmSupplyManage(TComponent *Owner)
- : TForm(Owner)
- {
- }
- //----------------------------------------------------------------------------
- void __fastcall TfmSupplyManage::FormCreate(TObject *Sender)
- {
- Table1->Open();
- // 上一窗体我们再窗体中设置下拉设计辞典
- // 本窗体在程序中创建,并从数据库中读取出辞典
- TQuery* pQuery = new TQuery(NULL);
- pQuery->DatabaseName = "db";
- pQuery->SQL->Add("select 姓名 from 业务员清单");
- pQuery->Open();
- TColumn *pCol = DBGrid1->Columns->Items[3];
- // 添加列表项
- while(!pQuery->Eof)
- {
- pCol->PickList->Add(pQuery->FieldByName("姓名")->AsString);
- pQuery->Next();
- }
- // 释放空间
- delete pQuery;
- }
- //----------------------------------------------------------------------------
- void __fastcall TfmSupplyManage::FormClose(TObject *Sender,
- TCloseAction &Action)
- {
- // 删除窗体并回收空间
- Action = caFree;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfmSupplyManage::Button1Click(TObject *Sender)
- {
- Table1->Filtered = false;
- // 设置table控件的filter属性
- // 可以起到查询条件的作用
- if(Edit1->Text.Length()==0)
- Table1->Filter = "";
- else
- Table1->Filter = " 拼音编码 = '" + Edit1->Text + "*'";
- Table1->Filtered = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfmSupplyManage::DBGrid1DblClick(TObject *Sender)
- {
- if(m_Input)
- {
- m_szSelectCode = Table1->FieldByName("供货商号")->AsString;
- this->Close();
- }
- }
- //---------------------------------------------------------------------------