Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7950219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:12:12+00:00 2026-06-04T02:12:12+00:00

If I was using C# I could use the .net framework’s SqlDataSourceEnumerator to discover

  • 0

If I was using C# I could use the .net framework’s SqlDataSourceEnumerator to discover and show a user a list of SQL Server instances on the network.

How can I do that in Delphi?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:12:14+00:00Added an answer on June 4, 2026 at 2:12 am

    To enumerate all available Microsoft SQL Servers, you can follow this excellent tutorial:

    Enumerating available SQL Servers. Retrieving databases on a SQL Server

    Included in Zarko‘s tutorial, there’s a link to download the full source code (direct download) which can be useful to quickly test it and check if it fits your needs.

    Edit Zarko Gajic’s main routine is:

    procedure ListAvailableSQLServers(Names : TStrings);
    var
      RSCon: ADORecordsetConstruction;
      Rowset: IRowset;
      SourcesRowset: ISourcesRowset;
      SourcesRecordset: _Recordset;
      SourcesName, SourcesType: TField;
    
        function PtCreateADOObject(const ClassID: TGUID): IUnknown;
        var
          Status: HResult;
          FPUControlWord: Word;
        begin
          asm
            FNSTCW FPUControlWord
          end;
          Status := CoCreateInstance(
                      CLASS_Recordset,
                      nil,
                      CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER,
                      IUnknown,
                      Result);
          asm
            FNCLEX
            FLDCW FPUControlWord
          end;
          OleCheck(Status);
        end;
    begin
      SourcesRecordset := PtCreateADOObject(CLASS_Recordset) as _Recordset;
      RSCon := SourcesRecordset as ADORecordsetConstruction;
      SourcesRowset := CreateComObject(ProgIDToClassID('SQLOLEDB Enumerator')) as ISourcesRowset;
      OleCheck(SourcesRowset.GetSourcesRowset(nil, IRowset, 0, nil, IUnknown(Rowset)));
      RSCon.Rowset := RowSet;
      with TADODataSet.Create(nil) do
      try
        Recordset := SourcesRecordset;
        SourcesName := FieldByName('SOURCES_NAME'); { do not localize }
        SourcesType := FieldByName('SOURCES_TYPE'); { do not localize }
        Names.BeginUpdate;
        try
          while not EOF do
          begin
            if (SourcesType.AsInteger = DBSOURCETYPE_DATASOURCE) and (SourcesName.AsString <> '') then
              Names.Add(SourcesName.AsString);
            Next;
          end;
        finally
          Names.EndUpdate;
        end;
      finally
        Free;
      end;
    end;
    

    I don’t know what I can add without lamering what Zarko’s explained.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working in a .NET Framework 4 project using server tags like
I'm starting a basic application using Python and PyQt and could use some experienced
I am using custom fonts in my website. I could use a local font
I'm using jquery mobile in my express project. How could I use Ajax for
I've written some tests for .net code that invokes calls to my SQL Server.
Background Information: Visual Studio 2010 (.NET Framework 4.0) Informix Server 7.31 Informix ClientSDK 3.50
I am using the .NET framework with the System.Data.OracleClient namespace. I have the oracle
I'm writing out some xml from C# using the .net framework's XmlTextWriter. This works
Question from certification exam: You use Microsoft Visual Studio 2010 and Microsoft .NET Framework
I'm writing my first Windows CE app using the .NET Compact Framework v3.5. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.