Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:1k
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- //初始化
- Table1->Active = False;
- Table1->TableType= ttParadox;
- // Table1->TableType= ttFoxPro;
- Table1->TableName="MyData";
- //定义字段
- Table1->FieldDefs->Clear();
- // Table1->FieldDefs->Add("SNO", ftInteger, 0, False);
- Table1->FieldDefs->Add("SNO", ftInteger, 0, True);
- Table1->FieldDefs->Add("Name", ftString, 30, True);
- Table1->FieldDefs->Add("Add", ftString, 50, True);
- Table1->FieldDefs->Add("Tel", ftString, 20, True);
- //创建表
- try
- {
- Table1->CreateTable();
- }
- catch(...)
- {
- ShowMessage("没有成功产生数据表");
- }
- }
- //---------------------------------------------------------------------------