Problem using GetServerList

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Ken McClain
Posts: 12
Joined: Fri 20 Jan 2006 17:44

Problem using GetServerList

Post by Ken McClain » Mon 22 Dec 2008 19:01

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

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 24 Dec 2008 11:38

I could not reproduce the problem. Please specify the server name contained in the list twice.

Ken McClain
Posts: 12
Joined: Fri 20 Jan 2006 17:44

Post by Ken McClain » Mon 29 Dec 2008 15:05

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.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 29 Dec 2008 15:30

It seems this code should work correctly.

Ken McClain
Posts: 12
Joined: Fri 20 Jan 2006 17:44

Post by Ken McClain » Mon 29 Dec 2008 15:51

Indeed it does. After reinstalling SQL2008 the problem has disappeared. Curious.

Thanks for your attention on this.

Post Reply