how to connect to database in C# using SqlConnection Object : How can I connect to a remote or local database using simple SqlConnection Object. I learned to do it this way: but my connection is failing. I read about creation of connection string from this page:

https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx

    using System.Data.SqlClient;
    
    namespace SyncApp_BuiltInProviders
    {
        public partial class Form1 : Form
        {
    
            private void btnSynchronize_Click(object sender, EventArgs e)
            {
                SqlConnection source_conn = new SqlConnection();
                source_conn.ConnectionString ="Server=localhost;Database = ptls; UID = root;Password = ODYSSEY99GRANITE;";
                source_conn.Open();
            }
        }
    }

           