谁能帮我提供关于DBGRID 和STRINGGRID的资料(55分)

L

lxfsql

Unregistered / Unconfirmed
GUEST, unregistred user!
我是一新手,很希望能得到各位大侠的帮助。。!!!
所有的MONEY全在这里了,拿去吧!!
 

大木马

Unregistered / Unconfirmed
GUEST, unregistred user!
看帮助吧,,
很齐啊,,[8D]
 
D

dingbaosheng

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure FillTitle(StrGrid: TStringGrid;
DataS: TDataSource;
FileName, TableName, FilterString: string);
var
I: Integer;
TempStr: Variant;
iniTemp: TIniFile;
begin
if not FileExists(ExtractFilePath(Application.ExeName) + FileName) then
begin
Application.MessageBox(PChar('配置文件丢失:' + ExtractFilePath(Application.ExeName) + FileName), '错误', MB_ICONERROR + MB_OK);
halt;
end
else
begin
iniTemp := nil;
try
iniTemp := TIniFile.Create(ExtractFilePath(Application.ExeName) + FileName);
except
Application.MessageBox(PChar('无法读取配置文件:' + ExtractFilePath(Application.ExeName) + FileName), '错误', MB_ICONERROR + MB_OK);
iniTemp.Free;
Application.Terminate;
end;
with StrGriddo
begin
ColCount := DataS.DataSet.FieldCount + 1;
ColWidths[0] := 18;
//第一列宽度
for I := 1 to ColCount - 1do
begin
// if DataS.DataSet.Fields.Fields[i - 1].DisplayName <> 'GUID' then
// begin
TempStr := 'SC_QUARTER_dbs_' + DataS.DataSet.Fields.Fields[i - 1].DisplayName;
Cells[i, 0] := iniTemp.ReadString(TableName, TempStr, '');
// end ;
end;
end;
iniTemp.Free;
//释放ini资源
end;
end;

procedure FillData(StrGrid: TStringGrid;
DataS: TDataSource);
//Fill Data
var
I, J: Integer;
begin
j := 1;
with StrGriddo
begin
while not DataS.DataSet.Eofdo
begin
for I := 1 to ColCount - 1do
Cells[i, j] := DataS.DataSet.Fields.Fields[i - 1].AsString;
j := j + 1;
DataS.DataSet.Next;
end;
end
end;

更多内容请联系阿拉 yzdbs#msn.com
 

Similar threads

回复
0
查看
851
不得闲
D
回复
0
查看
2K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部