topical media & game development

talk show tell print

professional-xml-19-Listing-19-5.txt / txt



  using System;
  using System.Web;
  using System.Web.Services;
  using System.Web.Services.Protocols;
  using System.Data;
  using System.Data.SqlClient;
  
  [WebService(Namespace = "http://www.wrox.com/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  public class Customers : System.Web.Services.WebService
  {
      public Customers () {
  
      }
  
      [WebMethod]
      public DataSet GetCustomers()
      {
          SqlConnection conn;
          SqlDataAdapter myDataAdapter;
          DataSet myDataSet;
          string cmdString = "Select * From Customers";
  
          conn = new 
             SqlConnection("Server=localhost;uid=sa;pwd=;database=Northwind");
          myDataAdapter = new SqlDataAdapter(cmdString, conn);
  
          myDataSet = new DataSet();
          myDataAdapter.Fill(myDataSet, "Customers");
  
          return myDataSet;
      }   
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.