日期:2014-05-18 浏览次数:20808 次
public class Service1 : IService1 { public DataEntityTier.NorthwindDataSet.CustomersDataTable GetCustomers() { DataEntityTier.NorthwindDataSet northwind = new DataEntityTier.NorthwindDataSet(); DataEntityTier.NorthwindDataSetTableAdapters.CustomersTableAdapter CustomersTableAdapter1 = new DataEntityTier.NorthwindDataSetTableAdapters.CustomersTableAdapter(); CustomersTableAdapter1.Fill(northwind.Customers); return northwind.Customers; } } -------------------------------- [ServiceContract] [XmlSerializerFormat] public interface IService1 { [OperationContract] DataEntityTier.NorthwindDataSet.CustomersDataTable GetCustomers(); } 客户端 using (Service1Client poxy = new Service1Client()) { dataGridView1.DataSource = poxy.GetCustomers(); }
public class Service1 : IService1 { public DataTable GetCustomers() { DataEntityTier.NorthwindDataSet northwind = new DataEntityTier.NorthwindDataSet(); DataEntityTier.NorthwindDataSetTableAdapters.CustomersTableAdapter CustomersTableAdapter1 = new DataEntityTier.NorthwindDataSetTableAdapters.CustomersTableAdapter(); CustomersTableAdapter1.Fill(northwind.Customers); Datatable dt = new DataTable(); dt.Tablename = "jj"; dt = northwind.Customers.copy(); return dt; } } [ServiceContract] [XmlSerializerFormat] public interface IService1 { [OperationContract] DataTable GetCustomers(); }