请教个问题【如何动态生成一个DBF文件,只需要包含字段】
我使用的是C++Builder6,在做一个小软件,需要动态生成一些DBF文件保存数据
[解决办法]
//创建处方交换表 if( !FileExists(tablepath+"\\test.DBF")) { //初始化 Table1->Active = false; Table1->TableType = ttFoxPro; Table1->TableName = tablepath+"\\test.DBF"; //定义字段 Table1->FieldDefs->Clear(); Table1->FieldDefs->Add("z_jysj",ftDateTime,0,false); Table1->FieldDefs->Add("z_zybh",ftInteger,0,false); Table1->FieldDefs->Add("z_cfbh",ftInteger,0,false); Table1->FieldDefs->Add("z_sflb",ftInteger,0,false); Table1->FieldDefs->Add("z_ypbm",ftString,13,false); Table1->FieldDefs->Add("z_sl",ftInteger,0,false); Table1->FieldDefs->Add("z_fy",ftFloat,0,false); Table1->FieldDefs->Add("z_sfid",ftString,18,false); Table1->FieldDefs->Add("z_zzys_id",ftInteger,0,false); Table1->FieldDefs->Add("z_ks_id",ftInteger,0,false); Table1->FieldDefs->Add("z_ypmc",ftString,30,false); Table1->FieldDefs->Add("z_gg",ftString,10,false); Table1->FieldDefs->Add("z_dw",ftString,10,false); Table1->FieldDefs->Add("z_dj",ftFloat,0,false); //创建表 try { Table1->CreateTable(); } catch(...) { } }