1 2 /*I always wanted to find a way to edit or create an OLE-DB connect string during 3 runtime, instead of doing it the old way by stopping an application and setting the 4 connect string during design time and restarting the application again. Well I have 5 found a way in doing so here is the source codes below to edit or create an OLE-DB 6 connect string.*/7 8 //---------------------------------------------------------------------------9 #include <vcl.h>
10 #pragma hdrstop
11 12 #include "Unit1.h"
13 //---------------------------------------------------------------------------14 15 #pragma package(smart_init)
16 #pragma resource "*.dfm"
17 TForm1 *Form1;
18 //---------------------------------------------------------------------------19 __fastcall TForm1::TForm1(TComponent* Owner)
20 : TForm(Owner)
21 {
22 }
23 //---------------------------------------------------------------------------24 25 void__fastcall TForm1::Button1Click(TObject *Sender)
26 {
27 adoCon->Connected=false;
28 adoCon->ConnectionString = PromptDataSource((unsignedint) Handle,
29 edtConnection->Text);
30 31 adoCon->Connected=true;
32 }
33 /*once the button is pressed it will bring up the Datalink form and from there you34 can create or edit a ole-db connection string. once you have finished with the form.35 the PromptDataSource function will return the connections string.*/36 37 //---------------------------------------------------------------------------