I have developed an application using C# on Visual Studio 2010 and SQL Server 2008.
My application is like a notification program that appears when the windows starts
in the Application's start-up Form_Load
event it connects to the SQL database as follows
da = new SqlDataAdapter("select info_id,info_text,cat_id from info " + cat, a.GetConnectionStringByName());
SqlCommandBuilder br = new SqlCommandBuilder(da);
ds = new DataSet();
da.Fill(ds, "em");
richTextBox1.Text = "";
txt = "";
DataRow dr = GetRow();
if (dr != null)
{
richTextBox1.Text = dr["info_text"].ToString();
txt = richTextBox1.Text;
}
and this is my connection string
<add name="Info_Bank_Project.Properties.Settings.KBankConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\KBank.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
When the application run in the startup when the system start, it makes an exception that says that connection timed out
Does anyone have an idea about the reason of that exception and how to solve it?