如何读取BDE Administrator中配置的数据源的本地路径 我在BDE Administrator中配置了一个连接本地Paradox7数据库的数据源因为程序要动态的每天在Paradox目录中建数据库为了灵活起见,我想在程序中读取BDE Adminstrator中配置的路径请问哪位知道如何读取?谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 註冊表路徑\HKEY_LOCAL_MACHINE\SOFTWARE\BORLAND\DATABASE ENGINE\分析下面代碼, 能夠幫你找到答案.procedure TForm1.BitBtn4Click(Sender: TObject);const DTS_ALIAS_NAME = 'NisDTS7';var ap: TStringList; {字串行表變數} answer: Integer;begin ap := TStringlist.Create; Session.GetAliasNames(ap); {取得別名列表} if (ap.IndexOf(DTS_ALIAS_NAME) = -1) then {判斷別名是否存在} begin answer := Application.MessageBox('別名Cntssamp不存在,現在創建嗎?', 'BDE資訊口', mb_OKCancel); {增加一個名?Cngzsamp的資料庫別名} if answer = IDCANCEL then begin ap.Free; Exit; end; Session.AddStandardAlias(DTS_ALIAS_NAME, 'e:\', 'Microsoft dBase Driver (*.dbf)'); Session.SaveConfigFile; {BDE配置文件存檔} end; ap.Clear; {取得別名Cngzsamp中的所有表格名稱列表} Session.GetTableNames(DTS_ALIAS_NAME, '', False, False, ap); if (ap.IndexOf('TSK') = -1) then {判斷表格是否存在} begin answer := Application.MessageBox('別名Cntssamp中不存在表格TSK,現在創建嗎?', '表格資訊視窗', mb_OKCancel); if answer = IDCANCEL then begin ap.Free; Exit; end; with table1 do begin Active := false; DatabaseName := DTS_ALIAS_NAME; {資料庫別名} TableName := 'TSK'; {表格名} TableType := ttDBase; {資料庫類型} with FieldDefs do {增加欄位} begin Clear; Add('SH', ftString, 30, False); {書號 String(30)} Add('SM', ftString, 30, False); {書名 String(30)} Add('CBS', ftString, 20, False); {出版社 String(20)} Add('CBRQ', ftDate, 0, False); {出版日期 Date} Add('YS', ftInteger, 0, False); {頁數 Integer} end; with IndexDefs do {增加索引} begin Clear; {按書號欄位建立主索引} Add('SHSY', 'SH', [ixPrimary, ixUnique]); end; CreateTable; {創建表格} end; end; ap.free; {釋放變數ap}end;===========================調用Session.GetAliasParams();這個方法獲取別名的參數, 參數內有Path=xxxx(:\aslkdfjasfd)讀取Path的值搞定!!!不過分太少.這種系統性的問題建義加分!!! apache2.x上的web service性能的问题 求一个任意日期加上60天后得出年、月、日的算法 对记录集的操作? 如何创建文件夹的问题?! 关于窗体继承的问题? foxpro的dbf文件要用什么odbc的形式打开亚 请教:从Oracle数据库中读出date类型值后的处理问题 请问在DELPHI中有没有将字符串转化为大写的函数!是不是UCASE不行 pagecontrol中tabsheet如何让其空间达到最大? 如何用quickreport做报表? 求AgentObjects_TLB控件 研究傅立叶变换,找到的代码贴出来共享。。
註冊表路徑
\HKEY_LOCAL_MACHINE\SOFTWARE\BORLAND\DATABASE ENGINE\分析下面代碼, 能夠幫你找到答案.procedure TForm1.BitBtn4Click(Sender: TObject);
const DTS_ALIAS_NAME = 'NisDTS7';
var
ap: TStringList; {字串行表變數}
answer: Integer;
begin
ap := TStringlist.Create;
Session.GetAliasNames(ap); {取得別名列表} if (ap.IndexOf(DTS_ALIAS_NAME) = -1) then {判斷別名是否存在}
begin
answer := Application.MessageBox('別名Cntssamp不存在,現在創建嗎?',
'BDE資訊口', mb_OKCancel);
{增加一個名?Cngzsamp的資料庫別名}
if answer = IDCANCEL then
begin
ap.Free;
Exit;
end;
Session.AddStandardAlias(DTS_ALIAS_NAME, 'e:\', 'Microsoft dBase Driver (*.dbf)');
Session.SaveConfigFile; {BDE配置文件存檔}
end; ap.Clear; {取得別名Cngzsamp中的所有表格名稱列表}
Session.GetTableNames(DTS_ALIAS_NAME, '', False, False, ap);
if (ap.IndexOf('TSK') = -1) then {判斷表格是否存在}
begin
answer := Application.MessageBox('別名Cntssamp中不存在表格TSK,現在創建嗎?',
'表格資訊視窗', mb_OKCancel);
if answer = IDCANCEL then
begin
ap.Free;
Exit;
end;
with table1 do
begin
Active := false;
DatabaseName := DTS_ALIAS_NAME; {資料庫別名}
TableName := 'TSK'; {表格名}
TableType := ttDBase; {資料庫類型}
with FieldDefs do {增加欄位}
begin
Clear;
Add('SH', ftString, 30, False); {書號 String(30)}
Add('SM', ftString, 30, False); {書名 String(30)}
Add('CBS', ftString, 20, False); {出版社 String(20)}
Add('CBRQ', ftDate, 0, False); {出版日期 Date}
Add('YS', ftInteger, 0, False); {頁數 Integer}
end;
with IndexDefs do {增加索引}
begin
Clear; {按書號欄位建立主索引}
Add('SHSY', 'SH', [ixPrimary, ixUnique]);
end;
CreateTable; {創建表格}
end;
end;
ap.free; {釋放變數ap}end;===========================
調用Session.GetAliasParams();
這個方法獲取別名的參數, 參數內有Path=xxxx(:\aslkdfjasfd)
讀取Path的值搞定!!!不過分太少.這種系統性的問題建義加分!!!