Click here to Skip to main content
15,911,030 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL to FOX Pin
Mazdak31-Dec-03 19:06
Mazdak31-Dec-03 19:06 
GeneralRunning SQL in Developer Studio Pin
Steve Schaneville31-Dec-03 4:23
professionalSteve Schaneville31-Dec-03 4:23 
Generalopen UDL Dialog at runtime Pin
Itanium30-Dec-03 1:59
Itanium30-Dec-03 1:59 
GeneralRe: open UDL Dialog at runtime Pin
Mazdak31-Dec-03 19:26
Mazdak31-Dec-03 19:26 
GeneralRe: open UDL Dialog at runtime Pin
Itanium31-Dec-03 21:45
Itanium31-Dec-03 21:45 
GeneralRe: open UDL Dialog at runtime Pin
Mazdak31-Dec-03 22:01
Mazdak31-Dec-03 22:01 
GeneralRe: open UDL Dialog at runtime Pin
Heath Stewart3-Jan-04 18:49
protectorHeath Stewart3-Jan-04 18:49 
GeneralRe: open UDL Dialog at runtime Pin
Richard Deeming9-Jan-04 6:29
mveRichard Deeming9-Jan-04 6:29 
Take a look at: HOW TO: Build a Connection String Programmatically in ADO.NET by Using Visual C# .NET[^]

For a more reusable sample, try this code:
C#
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ADODB;
using MSDASC;
 
public sealed class DataLinkDialog : CommonDialog
{
    private string _connectionString;
    
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="connectionString">The initial connection string</param>
    public DataLinkDialog(string connectionString)
    {
        _connectionString = connectionString;
    }
    
    /// <summary>
    /// Constructor
    /// </summary>
    public DataLinkDialog()
    {
        _connectionString = string.Empty;
    }
    
    /// <summary>
    /// Gets or sets the connection string
    /// </summary>
    public string ConnectionString
    {
        get { return _connectionString; }
        set { _connectionString = value; }
    }
    
    /// <summary>
    /// Resets the properties of the dialog box
    /// to their default values.
    /// </summary>
    public override void Reset()
    {
        _connectionString = string.Empty;
    }
    
    /// <summary>
    /// Displays the dialog box.
    /// </summary>
    /// <param name="hwndOwner">
    /// A value that represents the window handle of the 
    /// owner window for the common dialog box.
    /// </param>
    /// <returns>
    /// true if the dialog box was successfully run;
    /// otherwise, false.
    /// </returns>
    protected override bool RunDialog(IntPtr hwndOwner)
    {
        DataLinks dl = new DataLinksClass();
        try
        {
            if (null == _connectionString || 0 == _connectionString.Length)
            {
                object ret = dl.PromptNew();
                if (null == ret)
                {
                    return false;
                }
                else
                {
                    _connectionString = ((ADODB._Connection)ret).ConnectionString;
                    Marshal.ReleaseComObject(ret);
                    return true;
                }
            }
            else
            {
                Connection cn = new ConnectionClass();
                object ocn = cn;
                try
                {
                    cn.ConnectionString = _connectionString;
                    if (dl.PromptEdit(ref ocn))
                    {
                        _connectionString = cn.ConnectionString;
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                finally
                {
                    Marshal.ReleaseComObject(cn);
                }
            }
        }
        finally
        {
            Marshal.ReleaseComObject(dl);
        }
    }
}



"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Generalstored procedures - avoiding recompilations [modified] Pin
Marek Grzenkowicz26-Dec-03 21:44
Marek Grzenkowicz26-Dec-03 21:44 
GeneralRe: stored procedures - avoiding recompilations Pin
Chris Meech5-Jan-04 4:57
Chris Meech5-Jan-04 4:57 
GeneralRe: stored procedures - avoiding recompilations [modified] Pin
Marek Grzenkowicz5-Jan-04 5:49
Marek Grzenkowicz5-Jan-04 5:49 
GeneralRe: stored procedures - avoiding recompilations Pin
Mike Dimmick5-Jan-04 5:36
Mike Dimmick5-Jan-04 5:36 
GeneralRe: stored procedures - avoiding recompilations [modified] Pin
Marek Grzenkowicz5-Jan-04 6:21
Marek Grzenkowicz5-Jan-04 6:21 
GeneralData structure to describe HTML table Pin
Anonymous26-Dec-03 20:26
Anonymous26-Dec-03 20:26 
GeneralRe: Data structure to describe HTML table Pin
Colin Angus Mackay27-Dec-03 6:48
Colin Angus Mackay27-Dec-03 6:48 
Generalmysql and mysqldump commandline tools Pin
lady_fly26-Dec-03 10:22
lady_fly26-Dec-03 10:22 
GeneralLIKE operator in Access Pin
Mazdak25-Dec-03 21:02
Mazdak25-Dec-03 21:02 
GeneralRe: LIKE operator in Access Pin
Hesham Amin31-Dec-03 11:16
Hesham Amin31-Dec-03 11:16 
GeneralRe: LIKE operator in Access Pin
Mazdak31-Dec-03 19:03
Mazdak31-Dec-03 19:03 
GeneralRe: LIKE operator in Access Pin
Hesham Amin31-Dec-03 22:56
Hesham Amin31-Dec-03 22:56 
GeneralRe: LIKE operator in Access Pin
Mazdak1-Jan-04 0:22
Mazdak1-Jan-04 0:22 
GeneralSQL server - Permission and ownership Pin
CillyMe25-Dec-03 20:41
CillyMe25-Dec-03 20:41 
GeneralA string to compare with the rest of the records Pin
codeajay24-Dec-03 18:59
codeajay24-Dec-03 18:59 
Generalconnecting to Exces database(file) Pin
Bharat Gadhia23-Dec-03 10:14
Bharat Gadhia23-Dec-03 10:14 
GeneralRe: connecting to Exces database(file) Pin
Rob Graham25-Dec-03 9:59
Rob Graham25-Dec-03 9:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.