程序运行过程中直接配置数据源

name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3528650120430763&dt=1183890684015&lmt=1183890684&format=468x60_as&output=html&correlator=1183890684000&url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&ad_type=text_image&ui=rc%3A0&cc=100&flash=9&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency"> 
方法一:
procedure TForm1.Button1Click(Sender: TObject);
var
mdb:string;
begin
mdb:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Persist Security Info=False;';
if opendialog1.Execute then

adoquery1.Connected:=FALSE;
adoquery1.ConnectionString:= Format(Mdb,[DBOP.FileName]);
  if  opendialog1.FileName<>'' then
    begin
    adoquery1.LoginPrompt:=FALSE;
    adoquery1.Connected:=TRUE;
    end
  else
    begin
    showmessage('数据库没有连接,请重新连接');
    opendialog1.Execute;
    EXIT;
  END;
  if not adoquery1.Connected then begin
    Application.MessageBox('数据库文件无法打开','错误', MB_OK+ MB_ICONINFORMATION);
    Exit;
end;

name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3528650120430763&dt=1183890684015&lmt=1183890684&format=468x60_as&output=html&correlator=1183890684000&url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&ad_type=text_image&ui=rc%3A0&cc=100&flash=9&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency"> 

方法二:
USE ADOANED;

begin
adoconnection1.connected:= false;
if editconnectionstring(adoconnection1) then
   Try
   begin
     adoconnection1.connected:=true;
     adoconnection1.keepconnection:=true;
     adoconnection1.loginprompt:=false;
   end
   except
     Application.Terminate ;
   end;
end; 
name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3528650120430763&dt=1183890684015&lmt=1183890684&format=468x60_as&output=html&correlator=1183890684000&url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&ad_type=text_image&ui=rc%3A0&cc=100&flash=9&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency"> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值