Salut,
J'essaie de récuperer une liste d'objet de Sql Server avec un service WCF
Malheureusement, ca ne marche pas.
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 public List<string> GetCustomers(int intCustomer) { var objConnection = new SqlConnection(); var objDataset = new DataSet(); var objAdapater = new SqlDataAdapter(); var objCommand = new SqlCommand("Select * from TableF ;"); objConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ToString(); objConnection.Open(); objCommand.Connection = objConnection; objAdapater.SelectCommand = objCommand; objAdapater.Fill(objDataset); objConnection.Close(); var a = objDataset.Tables[0].Select().AsEnumerable(); return (List<string>)a; }
Erreur:
Le serveur distant a retourné une erreur : NotFound.Auriez vous une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 public System.Collections.ObjectModel.ObservableCollection<string> EndGetCustomers(System.IAsyncResult result) { object[] _args = new object[0]; System.Collections.ObjectModel.ObservableCollection<string> _result = ((System.Collections.ObjectModel.ObservableCollection<string>)(base.EndInvoke("GetCustomers", _args, result))); return _result; }
Merci![]()
Partager