很高兴今天能和您聊得这么深入,
非常感谢您对我的指导!希望
我们能成为好朋友。
procedure TransToExcel;
var
MsExcel: Variant;
begin
try
MsExcel:=CreateOleObject('Excel.Application');
except
ShowMessage('无法打开Microsoft Excel');
exit;
end;
MsExcel.Visible:=True;
MsExcel.WorkBooks.Add;
if FDataFrom is TStringGrid then
TransStringGridToExcel(FDataFrom As TStringGrid,MsExcel);
if FDataFrom is TDecisionGrid then
TransDecisionGridToExcel(FDataFrom As TDecisionGrid,MsExcel);
if FDataFrom is TDBGrid then
TransDBGridToExcel(FDataFrom As TDBGrid,MsExcel);
end;
procedure TransDecisionGridToExcel(DG1:TDecisionGrid;MsExcel:Variant);
var
i,j:Integer;//循环变量
begin
ColNum:=0;
RowNum:=0;
with DG1do
begin
ColNum:=ColCount;
RowNum:=RowCount;
For j:=-2 to RowNum-3do
For i:=-1 to ColNum-2do
MsExcel.Cells[j+3,i+2].Value:=Cells[i,j];
end;
{end with}
end;
{end Prodedure}
{===========================================================================}
object Query_WZQYD_GZD_SFJL: TQuery
Active = True
CachedUpdates = True
DatabaseName = 'ydgl_prj'
DataSource = DataSource_WZQYD_GZD
RequestLive = True
SQL.Strings = (
'SELECT YD_JL_WZQYD_GZD_SFJL.*'
'FROM YD_JL_WZQYD_GZD_SFJL'
'WHERE YD_JL_WZQYD_GZD_SFJL.TZS_ID=:TZS_ID')
UpdateObject = UpdateSQL_WZQYD_GZD_SFJL
Left = 66
Top = 282
ParamData = <
item
DataType = ftString
Name = 'TZS_ID'
ParamType = ptUnknown
end>
end
object DataSource_WZQYD_GZD_SFJL: TDataSource
DataSet = Query_WZQYD_GZD_SFJL
Left = 222
Top = 282
end
object UpdateSQL_WZQYD_GZD_SFJL: TUpdateSQL
ModifySQL.Strings = (
'update YD_JL_WZQYD_GZD_SFJL'
'set'
' TZS_ID = :TZS_ID,'
' SFJL_ID = :SFJL_ID,'
' XM = :XM,'
' DL =
L,'
' JE = :JE,'
' PJH =
JH,'
' RQ = :RQ,'
' SFY = :SFY'
'where'
' TZS_ID = :OLD_TZS_ID')
InsertSQL.Strings = (
'insert into YD_JL_WZQYD_GZD_SFJL'
' (TZS_ID, SFJL_ID, XM, DL, JE, PJH, RQ, SFY)'
'values'
'
TZS_ID, :SFJL_ID, :XM,
L, :JE,
JH, :RQ, :SFY)')
DeleteSQL.Strings = (
'delete from YD_JL_WZQYD_GZD_SFJL'
'where'
' TZS_ID = :OLD_TZS_ID')
Left = 392
Top = 282
end
object Query_WZQYD_GZD_SFJL_ADD: TQuery
DatabaseName = 'ydgl_prj'
Left = 566
Top = 282
end
1001 新装
2001 改建
3001 定换
4001 故障换表_烧表
4002 故障换表_卡表
4003 故障换表_自走
4004 故障换表_超差
4101 故障换表_峰谷表液晶部分
4102 故障换表_峰谷表电子部分
4103 故障换表_峰谷表机械部分
4104 故障换表_峰谷表死机
4105 故障换表_峰谷表电池欠压
4109 故障换表_峰谷表其他原因
4901 故障换表_其他
drop table da_yyyymmdd;
/
--如果有,先删除此表
create table da_yyyymmdd(rq char(8) PRIMARY KEY); --建立表,rq(日期)为主关键字
/
declare
i number;
--循环用
j char(8);
--记录日期值
begin
j:='20000101';
--设初始值
for i in 1..18250 loop
--365*50=600天
insert into da_yyyymmdd values(j);
--insert记录
j:=to_char(to_date(j,'yyyymmdd')+1,'yyyymmdd');
--日期加1天
end loop;
--循环结束
end;
/
commit;
drop table da_yyyymmdd;
/
create table da_yyyymmdd(rq char(8) PRIMARY KEY);
/
declare
i number;
j char(8);
begin
j:='20000101';
for i in 1..18250 loop
insert into da_yyyymmdd values(j);
j:=to_char(to_date(j,'yyyymmdd')+1,'yyyymmdd');
end loop;
end;
/
commit;