Bonjour,
J'essaye d'exécuter une requête sur mon SQL Server local, depuis mon code C#.
Voici la chaîne de connexion que j'utilise pour mon objet SqlConnection
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 using (SqlConnection) { if (SqlConnection.State == System.Data.ConnectionState.Closed) SqlConnection.Open(); string command = string.Format(@"INSERT INTO ArticleSearchTreeAllocation SELECT DISTINCT ArtNr, DLNr, GenArtNr, LKZ, LfdNr, SortNr, KritNr, KritWert, Exclude, AnzSofort FROM ArticleSearchTreeAllocation_tmp"); SqlCommand insertcommand = new SqlCommand(command, SqlConnection); insertcommand.ExecuteNonQuery(); }
Sachant que, en exécutant ma requête depuis SQL Server Mangement Studio, celle ci fonctionne.
Code : Sélectionner tout - Visualiser dans une fenêtre à part <add key="MyConnectionString" value="Persist Security Info=False;Trusted_Connection=True;database=MYDATABASE;server=(local);Connection Lifetime=0;Connection Timeout=7200;"/>
(Temps : 5 min, environ 15 000 000 d'inserts)
Dans le code C#, je me prends une exception du style au bout d'une quarantaine de secondes.
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
Pourquoi ? Dans ma chaîne de connexion, Connection Timeout=7200 soit 2h..
Qu'est ce que j'oublie de prendre en compte ?
Partager