namespace WCFService { // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together. [ServiceContract] public interface IService1 { [OperationContract] Customer GetCustomer(int id); // TODO: Add your service operations here } // Use a data contract as illustrated in the sample below to add composite types to service operations. [DataContract] public class Customer { [DataMember] public ArrayList GetCust { get; set; } } }
namespace WCFService { // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together. public class Service1 : IService1 { public Customer GetCustomer(int id) { SqlConnection con = new SqlConnection("Data Source=.;Database=Temp;Integrated Security=true"); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select * from tblCustomerInfo_Bangalore where CID = "+id; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); Customer cu = new Customer(); ArrayList list = new ArrayList(); foreach (DataRow row in ds.Tables[0].Rows) { list.Add(row); } cu.GetCust = list; return cu; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)