Page 1 of 1

Problem using GetServerList

Posted: Mon 22 Dec 2008 19:01
by Ken McClain
I'm using the 4.70.0.43 with Delphi 2007. My PC is running W2K8 and I have ONE instance of SQL2008 installed and not other versions of SQL.

I issue the following statement and I get the expected list of SQL Servers that I can see. The only problem is that it return my server name twice in the list.

MSAccess.GetServerList(cbServerList.Items);

What might account for this? I don't see this from other servers.

Thanks
Ken

Posted: Wed 24 Dec 2008 11:38
by Dimon
I could not reproduce the problem. Please specify the server name contained in the list twice.

Posted: Mon 29 Dec 2008 15:05
by Ken McClain
I removed SQL2008, all registry entries, and folders from my system. I confirmed that I have no other versions or instances of SQL installed. I rerun my test program and it worked properly. I am in the process of reinstalling SQL2008 and will test again. By the way this is my code:

unit DBFrm;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBAccess, MSAccess, OLEDBAccess;

type
TDBForm = class(TForm)
Label1: TLabel;
cbServerList: TComboBox;
Label2: TLabel;
cbDatabases: TComboBox;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure cbServerListChange(Sender: TObject);
procedure cbDatabasesChange(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
DBForm: TDBForm;

implementation

{$R *.dfm}
var
MSConn: TMSConnection;

procedure TDBForm.FormCreate(Sender: TObject);
begin
MSConn := nil;
DBAccess.ChangeCursor := FALSE;
MSAccess.GetServerList(cbServerList.Items);
end;

procedure TDBForm.FormDestroy(Sender: TObject);
begin
//
end;

procedure TDBForm.cbServerListChange(Sender: TObject);
begin
if (Assigned(MSConn)) then FreeAndNil(MSConn);
cbDatabases.Items.Clear;
MSConn := TMSConnection.Create(nil);
MSConn.Server := cbServerList.Text;
MSConn.Authentication := auWindows;
MSConn.Connect;
cbDatabasesChange(Sender);
end;

procedure TDBForm.cbDatabasesChange(Sender: TObject);
begin
MSAccess.GetDatabasesList(MSConn,cbDatabases.Items);
cbDatabases.ItemIndex := 0;
end;

end.

Posted: Mon 29 Dec 2008 15:30
by Dimon
It seems this code should work correctly.

Posted: Mon 29 Dec 2008 15:51
by Ken McClain
Indeed it does. After reinstalling SQL2008 the problem has disappeared. Curious.

Thanks for your attention on this.