How to create an sqlconnection in a class with c# to use in all form?
<ol>
<li>Create sqlserver connection in class</li>
<li>call connection class to use all form.</li>
</ol>

<p>I want to create SQLServer connection in class with C# to use all forms.</p>

<p>Hereabout code of connection in class file </p>

<pre><code>public System.Data.SqlClient.SqlConnection Con = new System.Data.SqlClient.SqlConnection();
public System.Data.SqlClient.SqlCommand Com = new System.Data.SqlClient.SqlCommand();

public string conStr;

public SQL2(string conStr)
{
    try
    {
        Con.ConnectionString = conStr;
        Con.Open();
        Com.Connection = Con;
        Com.CommandTimeout = 3600;
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

public bool IsConnection()
{
    Boolean st;

    if (Con.State==ConnectionState.Open)
    {
        st=true;
    }
    else
    {
        st = false;
    }

    return st;
}  
</code></pre>

<p>Can give me full example code?</p>
