终于有漳洲出来招聘了。楼主怎么样我是漳洲角美的。工作经验1.5年。现在厦门软件公司。代码给你一段怎么样。毕业至今一直从事软件开发行业。下面是我自已设计的一个框架。下面是一个类。所有的操作都继承这个类。
procedure tpublic.MOVE(adodataset:TCUSTOMADOdataset;spfirst,spprior,spnext,splast:tspeedbutton);
begin
if adodataset.State=dsinactive then
//断开连接时
begin
spfirst.Enabled:=false;//
spprior.Enabled:=false;//
spnext.Enabled:=false;//
splast.Enabled:=false;//
end
else
if adodataset.bof then
begin
spfirst.Enabled:=false;//最前
spprior.Enabled:=false;//向前
spnext.Enabled:=true;//向后
splast.Enabled:=true;//最后
end
else
if adodataset.eof then
begin
spfirst.Enabled:=true;//
spprior.Enabled:=true;//
spnext.Enabled:=false;//
splast.Enabled:=false;//
end
else
begin
spfirst.Enabled:=true;//
spprior.Enabled:=true;//
spnext.Enabled:=true;
splast.Enabled:=true;
end;
end;
procedure tpublic.OPERATIONstate(adodataset:TCUSTOMADOdataset;spedit,spcopy,spinsert,spdelete,spsave,spcancel,spprint,spexcell,spquery:tspeedbutton);
begin
if adodataset.State=dsinactive then
//断开连接时
begin
spedit.Enabled:=false;
spcopy.Enabled:=false;
spinsert.Enabled:=false;
spdelete.Enabled :=false;
spsave.Enabled :=false;
spcancel.Enabled :=false;
spprint.Enabled :=false;
SPEXCELL.Enabled :=FALSE;
spquery.Enabled :=false;
end
else
if adodataset.State=dsedit then
//编辑状态时
begin
spedit.Enabled:=false;
SPPRINT.Enabled :=false;
//打印的状态跟编辑状态一致
SPEXCELL.Enabled :=FALSE;
spquery.Enabled :=false;
spsave.Enabled :=true;
spcancel.Enabled:=true;
end
else
if adodataset.State=dsinsert then
//插入状态时
begin
spedit.Enabled:=false;
//插入状态时不允许编辑
spprint.Enabled:=false;
SPEXCELL.Enabled:=FALSE;
spquery.Enabled :=false;
spsave.Enabled :=true;
spcancel.Enabled :=true;
end
else
if adodataset.RecordCount=0 then
//必须放在浏览状态前,因为初始化时
begin
//默认都要进”STATE”这过程中,
spedit.Enabled :=true;
// 如果不使用该选择的话,当记录RECORDCOUNT=0时
spprint.Enabled :=false;
spexcell.Enabled:=false;
//SPDELETE按钮的ENABLED:=TRUE;删除便出错。
spquery.Enabled:=false;
spdelete.Enabled:=false;
SPCOPY.Enabled :=FALSE;
spsave.Enabled :=false;
spcancel.Enabled :=false;
end
else
if adodataset.State=dsbrowse then
//浏览状态时
begin
spedit.Enabled:=true;
spcopy.Enabled :=true;
spinsert.Enabled :=true;
spdelete.Enabled :=true;
spsave.Enabled :=false;
spcancel.Enabled:=false;
spprint.Enabled :=true;
spexcell.Enabled:=true;
spquery.Enabled :=true;
end;
end;
procedure tpublic.saveAsExcel(DBGRID:TDBGRID;adodataset:TCUSTOMADOdataset);
var
fieldNum: integer;
i,j : integer;
exls,sheet: variant;
begin
try
exls:=createoleobject('Excel.application');
sheet:=createoleobject('excel.sheet');
except
application.MessageBox('请先安装MICROSOFT EXCEL!','提示',mb_ok+mb_iconinformation);
exit;
end;
sheet:=exls.workBooks.add;
with ADODATASETdo
begin
DisableControls;
fieldNum := dbgrid.fieldCount;
for i:=1 to fieldNumdo
begin
exls.Cells[1,i].value:=dbgrid.Columns[i-1].Title.Caption;
//exls.Cells[1,i].value:=Fields[i-1].FieldName;
end;
first;
i:=2;
while not eofdo
begin
for j:=1 to fieldNumdo
begin
exls.Cells[i,j]:=fields[j-1].AsString;
end;
next;
i:=i+1;
end;
EnableControls;
exls.visible:=true;
end;
end;