我現在在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的參數
解决方案 »
- 一个Delphi5+Sqlserver2000做的老程序如何快速改成英文版
- 请问com组件如何访问Form中的属性和方法
- 如何通过函数获得当前计算机中的打印机列表,同时获得打印机的连接端口?
- 在Delphi中使用SQL语句对数据库进行模糊查询的问题,请教高手。
- 关于线程,消息,时钟的一个疑难问题(无法调试,困惑)
- 界面中有一些dbedit控件,我移到第10条记录,将dbedit10控件text设一值为100,然后我只想把这第二条记录的dbedit10对应的字段10ed值改为1
- 有谁知道如何用将modem切换到语音状态?
- 有用过gifimage的请进!
- 谁有delphi专用的按钮图片库呀,小弟急需!!
- 如何在程序里实现生成AVI文件的功能?
- 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