我現在在DLL 定義的一個過程
Procedure Open_GroupForm(form_name:string;ado_grid:Twincontrol;ado_connts:string);stdcall;
DLL編譯沒有問題,且可以調用,但傳過來的DBGrid1跟本就沒有一點用處,(ado_grid.ClassType=Tdbgrid)=False 跟本就沒有找到,我不知道為什麼,這個DLL編譯成EXE是可以正常運行的,也就是(ado_grid.ClassType=Tdbgrid)=True
TDBGrid不知道到底可不可以作為DLL的參數
Procedure Open_GroupForm(form_name:string;ado_grid:Twincontrol;ado_connts:string);stdcall;
DLL編譯沒有問題,且可以調用,但傳過來的DBGrid1跟本就沒有一點用處,(ado_grid.ClassType=Tdbgrid)=False 跟本就沒有找到,我不知道為什麼,這個DLL編譯成EXE是可以正常運行的,也就是(ado_grid.ClassType=Tdbgrid)=True
TDBGrid不知道到底可不可以作為DLL的參數
解决方案 »
- 在delphi编程中,出现的问题
- Undeclared identifier: 'ActiveControl'
- 自动生成下拉菜单!急,(50分相送)
- 关于COMBOX中的ITEM保存多个值的问题
- qr3.62的应用问题
- 大家必定受益非浅====> 自编写的VCL控件如何能阻止它失去键盘输入焦点
- 高手解答,算法问题!
- 问一下各位我预览打印报表时为什么各个表格和字都对不齐啊,急。。。。。。
- 当删除ACCESS表中完全相同的记录时出现错误,怎样解决?
- 一个关于ADOTABLE控件的一个问题,等着大家来救命!
- sql-server后台的存储过程如何搬到前台执行?因为我想做单机版的程序,数据库是access.
- 在delphi7中怎样撒消操作??
Procedure Open_GroupForm(form_name:string;ado_grid:Twincontrol;ado_connts:string);stdcall;
在D7有没有引和ShareMM这个单元?如果没有就把form_name:string改为PChar类型传递!
在D2006里面的话,就不用了...
ado_connt:Tadoconnection;
Row_data:Array of string;
col_data:Array of string; //全局變量Procedure Open_GroupForm(form_name:PChar;ado_grid:TDBGrid;ado_connts:PChar);stdcall;
begin //在應用程序中傳過來的是DBGrid1
if not Assigned(Group_mainF) then
Group_mainF:=TGroup_mainF.Create(nil);
Group_mainF.init_dataset(form_name,ado_grid,ado_connts);
Group_mainF.Show;
end;
procedure TGroup_mainF.init_dataset(form_name:PChar;ado_Grid: TDBGrid;ado_connts:PChar);
var i:integer;
row_n,Col_n:integer; //得出ado_Grid對應的數據集用在統計中的列數據和行數據的共有數組大小
r_n,c_n:integer;
begin
ado_z:=ado_Grid;
row_n:=0; Col_n:=0;
r_n:=0; c_n:=0;
If (ado_z.ClassType=Tdbgrid) then
Begin //跟本就沒有執行裡面,也就是ado_z.ClassType<>Tdbgrid
if TDBGrid(ado_z).DataSource.DataSet is Tadodataset then
Begin
for i:=0 to Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields.Count -1 do
if Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].datatype in[ftMemo,Ftstring,ftDate,ftDateTime] then
inc(row_n)
else if Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].datatype in[ftSmallint,ftInteger,ftWord,ftFloat,ftBCD] then
inc(Col_n);
end
else
Begin
for i:=0 to TADOQuery(TDBGrid(ado_z).DataSource.DataSet).Fields.Count -1 do
if TADOQuery(TDBGrid(ado_z).DataSource.DataSet).Fields[i].datatype in[ftMemo,Ftstring,ftDate,ftDateTime] then
inc(row_n)
else if TADOQuery(TDBGrid(ado_z).DataSource.DataSet).Fields[i].datatype in[ftSmallint,ftInteger,ftWord,ftFloat,ftBCD] then
inc(Col_n);
end;
end; setLength(row_data,Row_n);
setLength(col_data,col_n); If (ado_z.ClassType=Tdbgrid) then
Begin
if TDBGrid(ado_z).DataSource.DataSet is Tadodataset then
Begin
for i:=0 to Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields.Count -1 do
if Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].datatype in[ftMemo,Ftstring,ftDate,ftDateTime] then
begin
Row_data[r_n]:='('+Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].DisplayLabel+')['+Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].FieldName+']';
inc(R_n);
end
else if Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].datatype in[ftSmallint,ftInteger,ftWord,ftFloat,ftBCD] then
begin
Col_data[C_n]:='('+Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].DisplayLabel+')['+Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].FieldName+']';
inc(C_n);
end;
end
else
Begin
for i:=0 to TADOQuery(TDBGrid(ado_z).DataSource.DataSet).Fields.Count -1 do
if TADOQuery(TDBGrid(ado_z).DataSource.DataSet).Fields[i].datatype in[ftMemo,Ftstring,ftDate,ftDateTime] then
begin
Row_data[r_n]:='('+TADOQuery(TDBGrid(ado_z).DataSource.DataSet).Fields[i].DisplayLabel+')['+Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].FieldName+']';
inc(R_n);
end
else if TADOQuery(TDBGrid(ado_z).DataSource.DataSet).Fields[i].datatype in[ftSmallint,ftInteger,ftWord,ftFloat,ftBCD] then
begin
Col_data[C_n]:='('+TADOQuery(TDBGrid(ado_z).DataSource.DataSet).Fields[i].DisplayLabel+')['+Tadodataset(TDBGrid(ado_z).DataSource.DataSet).Fields[i].FieldName+']';
inc(C_n);
end;
end;
end;
try
ado_connt:=Tadoconnection.Create(nil);
ado_connt.ConnectionString :=ado_connts;
ado_connt.LoginPrompt :=false;
ado_connt.Connected :=true; name_type:=form_name;
ado_main.Connection :=ado_connt;
ado_main.SQL.Add('select * from budwn_sys_group_report where form_name='''+form_name+'''');
ado_main.open ;
except
showmessage('數據庫連接錯誤!');
end;
只要是TObject,就會發生: Sender.ClassType <> TObject