public static AsyncConnectionResult TryToOpenConnection(ConnectionParams cp, ref string error)
        {
            if (cp == null)
            {
                throw new Exception("Connection parameters instance is null!");
            }

            frmAsyncConnectionOpener frm = new frmAsyncConnectionOpener();

            frm._cp   = cp.CreateCopy();
            frm._conn = null;
            frm.BringToFront();
            frm.ShowDialog();
            error = frm._lastError;
            return(frm._result);
        }
Beispiel #2
0
        public static ProjectItem CreateConnectionSpec(Project prj, ConnectionParams cp)
        {
            if (cp == null)
            {
                throw new NullParameterException("ConnectionParams paramater is null!");
            }

            ProjectItem result = new ProjectItem(ProjectItemType.ConnectionSpec);

            result.Name = cp.Server + " {" + cp.Database + "}";
            if (prj != null)
            {
                if (!prj.ConnectedItems.ContainsKey(cp.ID.ToString()))
                {
                    prj.ConnectedItems.Add(cp.ID.ToString(), result);
                }
            }

            result.IsConnectedItem = true;
            result.ConnectionSpec  = cp.CreateCopy();
            return(result);
        }