delphi中如何打开.udl文件对话框?(50分)

M

mazheng

Unregistered / Unconfirmed
GUEST, unregistred user!
delphi中如何打开.udl文件对话框?
 
用ShellExecute不行吗?
 
ShellExecute(0, nil, 'c:/a.udl', nil, nil, SW_NORMAL);<br>可以呀,<br>环境:xp + d7
 
我用 ShellExecute 也可以。
 
uses AdoConEd;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; ADOConnection1.Close;<br>&nbsp; if EditConnectionString(ADOConnection1) then begin<br>&nbsp; &nbsp; label1.caption := ADOConnection1.ConnectionString;<br>&nbsp; end;<br>end;
 
str :=PromptDataSource(application.Handle,'')<br>返回的是str,''里面是默认数据库连接字符串
 
PromptDataSource
 
用ShellExecute是可以的,不過要先在資料夾選項中把udl的打開方式改為記事本,
 
顶部