开发者

odbc datasource connection at runtime through delphi

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜