private string GetConnectionString(string connectionString) { DataLinksClass dataLinks = new DataLinksClass(); _Connection connection = null; if (String.IsNullOrEmpty(connectionString)) { connection = dataLinks.PromptNew() as _Connection; if (connection == null) { return(""); } return(connection.ConnectionString); } connection = new ConnectionClass(); connection.ConnectionString = connectionString; object objConnection = connection; if (dataLinks.PromptEdit(ref objConnection)) { return(connection.ConnectionString); } return(connectionString); }
public static string PromptNew() { var dataLinks = new DataLinksClass(); try { var connection = dataLinks.PromptNew() as _Connection; if (connection != null) { try { return(connection.ConnectionString); } finally { Marshal.ReleaseComObject(connection); } } return(null); } finally { Marshal.ReleaseComObject(dataLinks); } }
public string EditValue(string value) { DataLinks dataLinks = new DataLinksClass(); var con = (Connection)dataLinks.PromptNew(); if (con == null) return value; return con.ConnectionString; }
public string EditValue(string value) { DataLinks dataLinks = new DataLinksClass(); var con = (Connection)dataLinks.PromptNew(); if (con == null) { return(value); } return(con.ConnectionString); }
/// <summary> /// Handles event when Create Connection button is clicked /// </summary> /// <param name="param"></param> /// <remarks></remarks> private void CreateConnCommandClick(object param) { DataLinks udl = new DataLinksClass(); udl.hWnd = _windowHandle != IntPtr.Zero ? _windowHandle.ToInt32() : new WindowInteropHelper(App.Current.MainWindow).Handle.ToInt32(); _connAdo = udl.PromptNew() as ADODB.Connection; if ((_connAdo != null) && TestConnection(_connAdo.ConnectionString)) { _connStrBuilder.ConnectionString = _connAdo.ConnectionString; OnPropertyChanged("ConnectionString"); OnPropertyChanged("SupportsSchemata"); } }
private static bool GetNewConnectionStringFromWizard(out string newConnectionString) { newConnectionString = null; DataLinks dataLinks = new DataLinksClass(); object result = dataLinks.PromptNew(); if (result != null) { newConnectionString = ((ADODB.Connection)result).ConnectionString; return(true); } return(false); }
private void btnConnectString_Click(object sender, EventArgs e) { var dlDlg = new DataLinksClass(); _Connection con = null; con = (_Connection)dlDlg.PromptNew(); if (con == null) { return; } var str = con.ConnectionString; if (!str.Contains(MULTI)) { str = str + MULTI; } tbConnectionString.Text = str; }