Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I'm having some difficulty with connecting an executeing sql statements against the sql server 2000. I'm working in vs2005. I used the folowing code:
SqlConnection myConnection = new SqlConnection("user id=username;" +
"database=databasename; " + "connection timeout=30");
catch (Exception ef)
SqlCommand myCommand1 = new SqlCommand("delete tabele1", myConnection);
SqlCommand myCommand = new SqlCommand("INSERT INTO tabele1(column1, column2) " +
"select month(s.column3),sum(s.column4) from tabele2 s group by month(s.column3) order by month(s.column3)", myConnection);myCommand1.ExecuteNonQuery();
catch (Exception er)
Problem is that that I get an error timeout expired or server not responding on the line myCommand.ExecuteNonQuery();
When I compile the application 3 times then it works. First two times it throwse the exception, and after that it works fine. If I start the servers query analyzer of profiler withe the same name and password the program works fine from the first time. There is obviously some connection problem, but what....
0 · ·