Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [WebMethod]
- public List<clsVFCustomer> GetVFCustomerList()
- {
- List<clsVFCustomer> lstVFCust = new List<clsVFCustomer>();
- SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connString"].ToString());
- DataTable dt = new DataTable();
- SqlCommand command = new SqlCommand("SELECT * FROM VFCustomer", conn);
- command.CommandType = CommandType.Text;
- command.CommandTimeout = 0;
- SqlDataAdapter sda = new SqlDataAdapter(command);
- conn.Open();
- sda.Fill(dt);
- conn.Close();
- dt.TableName = "dt";
- if (dt.Rows.Count > 0)
- {
- for (int idx = 0; idx < dt.Rows.Count; idx++)
- {
- clsVFCustomer vfCust = new clsVFCustomer();
- vfCust.Name = dt.Rows[idx]["Name"].ToString();
- vfCust.Address = dt.Rows[idx]["Address"].ToString();
- vfCust.ContactNo = dt.Rows[idx]["ContactNo"].ToString();
- vfCust.Email = dt.Rows[idx]["Email"].ToString();
- lstVFCust.Add(vfCust);
- }
- }
- return lstVFCust;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement