Cycle de progression Faire (quelque chose qui marche) -> comprendre ce que l’on fait/comment cela marche -> pousser plus loin les notions

| [WebMethod] public System.Data.DataSet ChargerContacts() { OleDbDataAdapter oOleDbDataAdapter; oOleDbDataAdapter = new OleDbDataAdapter(); OleDbDataAdapter.sCONNECTIONSTRING = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsromagnyMes documentsVisual Studio 2005WebSitesServiceWebTestsApp_DataContacts.mdb"; oOleDbDataAdapter.CreerSelectCommand(System.Data.CommandType.Text, "select code_contact,nom_contact,prenom_contact from CONTACT"); return oOleDbDataAdapter.ChargerDataSet(); } |




| private void toolStripButton1_Click(object sender, EventArgs e) { // 1 declarer une instance du service web // localhost est le nom par défaut, mais on peut le renommer... localhost.Service oService; oService = new ApplicationClienteTestWebservice.localhost.Service(); // 2 - execution des methodes du web service et utilisation/affichage des données retournées // on affecte trés facilement à la datasource de bindingsource1 la table retournée // par la méthode ChargerContacts du web service this.bindingSource1.DataSource = oService.ChargerContacts().Tables[0]; dataGridView1.DataSource = bindingSource1; } |
