Salut à tous,
j'ai fait un bout de programme permettant de trouver le nom de l'instance SQL se trouvant sur mon PC :
Avant hier, elle fonctionnait bien, mais elle ne fonctionne plus et je ne comprends pas vraiment... :-/
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 void FonctionInstanceSQL() { // Ajouter : using System.Data.Sql; // Retrieve the enumerator instance and then the data. SqlDataSourceEnumerator MesInstances = SqlDataSourceEnumerator.Instance; //--------------------------------------C'est maintenant très long entre ces deux lignes------------------------------------- System.Data.DataTable MaTableInstance = MesInstances.GetDataSources(); // Display the contents of the table. DisplayData(MaTableInstance); } void DisplayData(System.Data.DataTable table) { foreach (System.Data.DataRow row in table.Rows) { foreach (System.Data.DataColumn col in table.Columns) { if (col.ColumnName == "InstanceName") { MessageBox.Show(col.ColumnName + " : " + row[col]); NomInstanceSQL = row[col].ToString(); } } } }
Je pense n'avoir que redémarré mon PC.
des idées ?
Partager