程序運行過程中直接配置數據源

<iframe 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"></iframe> 
方法一:
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;

<iframe 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"></iframe> 

方法二:
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; 
<iframe 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"></iframe> 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章