开发者

odbc datasource connection at runtime through delphi

开发者 https://www.devze.com 2023-03-23 03:18 出处:网络
can we create ODBC datasource connection at runtime? If yes then can you plz help r开发者_如何学JAVAegarding how to do it.

can we create ODBC datasource connection at runtime? If yes then can you plz help r开发者_如何学JAVAegarding how to do it. Currently I am created the ODBC datasource connection manually through Control Panel--> Administrative Tools --> Datasources. But i want to create that at runtime when user run application.

thanks for the help.


You can use SQLConfigDataSource (Delphi example).


Yes, you can do it. As @TOndrej points out, you can create a ODBC datasource at runtime. But usually you don't need to. You might just create a Data Connection in runtime without an ODBC datasource.

Something like this, using ADO components to a MS Jet OLE DB ...

  if ADOConnection1.connected then ADOConnection1.close;
  ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'+
                'Data Source='+filename+';'+
                'Persist Security Info=False';
  ADOConnection1.LoginPrompt:=false;
  ADOQuery1.Connection:=ADOConnection1;
  ADOConnection1.Open;
  ....
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号