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 29 30 31 32 33 34 35 36 37 38
| using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
SqlConnection conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["hoteldbConnectionString"].ToString());
SqlDataAdapter da_pays;
SqlDataAdapter da_client;
public Service()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public DataSet getClients()
{
da_client = new SqlDataAdapter("select cin,GENRE_CLI,NOM_CLI,PRENOM_CLI,ENTREPRISE_CLI,ADRESS_CLI,PAYS_CLI,TEL_CLI,FAX_CLI,EMAIL_CLI,date_insc from CLIENT", conn);
DataSet ds = new DataSet();
da_client.Fill(ds, "CLIENT");
return ds;
}
[WebMethod]
public DataSet getPays()
{
da_pays = new SqlDataAdapter("select * from pays", conn);
DataSet ds = new DataSet();
SqlCommandBuilder myCmd = new SqlCommandBuilder(da_pays);
da_pays.Fill(ds, "pays");
return ds;
} |
Partager