📄 bcjq029.txt
字号:
C++ Builder开发者:程序员之家
var how_many_ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
首页
| 控件天堂 | 控件使用
| 编程技巧
| 源代码 | 编程工具 |
系统补丁 | 电子书籍 | 技术论坛
| 相关链接
if (ad==1) {document.write(''+'');}
if (ad==2) {document.write(''+'');}
if (ad==3) {document.write(''+'');}
var marqueecontents=''+scroll_text+''
if (document.all)
document.write(''+marqueecontents+'')
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializemarquee()
}
}
function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write(marqueecontents)
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.height
scrollit()
}
function scrollit(){
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.top-=speed
setTimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.top=marqueeheight
scrollit()
}
}
window.onload=regenerate2
当前位置
:
编程技巧
如何给Table减肥
用BCB进行多媒体数据库开发时常会发现这样一个现象,当你把一条记录从表中删除时,表档
大小并没有相应减小。这样在进行多次插入删除之后,表文件就会越来越庞大。之所以会出现这种现象,是因为TTable控件的
Delete Method并不真正从表中删除记录,而只是在记录前加上一个删除标志。在DBase和Foxpro中用Pack语句对表进行压缩,但在TTable类中却没有相应的函数。其实在BDE的API函数中已经提供了DbiPackTable来对DBase或Foxpro表进行压缩,但是这个函数对Paradox的表不起作用。要想给Paradox
表减肥得用DbiDoRestructure函数来完成,以下例程完成Pack
Paradox表的功能。
//This function Pack the Paradox table. write by zodiac
void __fastcall TForm1::PackParadoxTable(hDBIDb hDB, AnsiString TblName)
{
//Paradox table use a quite different way to be packed than
//DBase or Foxpro table, it use the DBiDoRestructure not the
// DBiPackTable
DBIResult rslt;
CRTblDesc TblDesc;
//filled the structure CRTbiDesc with 0
memset((void *)&TblDesc,0,sizeof(CRTblDesc));
//copy the table name and type to the structure
lstrcpy(TblDesc.szTblName,TblName.c_str());
lstrcpy(TblDesc.szTblType,szPARADOX);
//set bPack to true to specify Pack Function
TblDesc.bPack=true;
//Pack the table
rslt=DbiDoRestructure(hDB,1,&TblDesc,NULL,NULL,NULL,false);
if(rslt!=DBIERR_NONE)
Application->MessageBox("不能压缩表","压缩数据表出错",MB_ICONERROR);
}
注意,在Restructure之前,表必须处于关闭状态。以下例程调用PackParadoxTable.
void __fastcall TForm1::PackTable(AnsiString table_name)
{
//Pack the table
TTable *temp_table=new TTable(Form1);
temp_table->DatabaseName="YourDatabaseAlias";
temp_table->TableName=table_name;
temp_table->Exclusive=true;
temp_table->Open();
//get the Database Handle
hDBIDb hDB=temp_table->DBHandle;
temp_table->Close();
PackParadoxTable(hDB,table_name);
temp_table->Close();
temp_table->Free();
}
对Foxpro和DBase的Pack参见BDE API Help的DbiPackTable函数说明。
if (ad==1) {document.write(''+'');}
if (ad==2) {document.write(''+'');}
if (ad==3) {document.write(''+'');}
C++ Builder开发者®
2000年06月01日 站长:唐朝