1
Answer

problem

ganesh sadu

ganesh sadu

11y
902
1
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)


i saw this problem  when i connect my visual studio 2010 and ms server 2008 
string connstring = "server=Data Source=KSADULAN-PC\\SQLEXPRESS;Initial Catalog=Hanumantha;Integrated Security=True";

Cone = new SqlConnection(connstring);
         
  Cone.Open();----------------------(here problem start)
                Come=new SqlCommand("insert into cheque values("+chno.Text+","+amo.Text+","+Date.Text+","+Towhom.Text+","+Purpo.Text+"')",Cone);
                try
                {
                    Come.ExecuteNonQuery();
                    MessageBox.Show("Saved............");
                }
                catch (Exception)
                {
                    MessageBox.Show("not saved......");
                }
                finally
                {
                    Cone.Close();
                }

this is my code please consider it.now i am waiting to your answer

Answers (1)