I always wanted to find a way to edit or create an OLE-DB connect string during
runtime, instead of doing it the old way by stopping an application and setting the
connect string during design time and restarting the application again. Well I have
found a way in doing so here is the source codes below to edit or create an OLE-DB
connect string.
1 2 procedure Tform1.Button1Click(Sender: TObject);
3 begin4 adoCon.Connected :=false;
5 // PromptDataSource takes the form handle and the6 // second pramater takes a empty string or a OLE-DB Connection string to edit.7 8 adoCon.ConnectionString := PromptDataSource(handle,edtConnection.text);
9 adoCon.Connected :=true;// ado set to true to open the new connection10 end;
11 12 {once the button is pressed it will bring up the Datalink form and from there you 13 can create or edit a ole-db connection string. once you have finished with the form.14 the PromptDataSource function will return the connections string.}