unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
s : string;
begin
if adoconnection1.connected then
begin
adoconnection1.Connected:=false;
end else
begin
s := adoconnection1.ConnectionString;
s := adodb.PromptDataSource(self.Handle, s);
adoconnection1.ConnectionString := s;
try
adoconnection1.connected:=true;
except
end;
end;
Edit1.text := s;
end;
end.
What I have tried:
I have this code for access database i want the same code for sql server thanks