jbailey.spatialbridge

Exception calling DataServerManager.Connect

Discussion created by jbailey.spatialbridge on Mar 21, 2014
Using the code samples provided by Esri, I'm trying to connect to a SQL Server instance using the DataServerManager class. Following is the entirety of my code in a .NET console application:

using System;
using ESRI.ArcGIS.DataSourcesGDB;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS;

namespace ConnectToSQLServer
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                RuntimeManager.Bind(ProductCode.Engine);
                IAoInitialize aoInitialize = new AoInitialize();
                aoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);

                IDataServerManager dataServerManager = new DataServerManager();
                dataServerManager.ServerName = "MONTREAL\\SQLEXPRESS";
                dataServerManager.Connect();
                if (dataServerManager.IsConnected)
                {
                    Console.WriteLine("DataServerManager is connected.");
                }
                else
                {
                    Console.WriteLine("DataServerManager is not connected.");
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
            finally
            {
                Console.ReadLine();
            }                
        }
    }
}


When dataServerManager is called, the following exception is raised:

-  exception {"A syntax error occurred trying to evaluate a query string (Exception from HRESULT: 0x80040203)"} System.Exception {System.Runtime.InteropServices.COMException}


Any ideas?

Thanks,

Jon.

Outcomes