Thursday, December 5, 2013

code

public TestDatabasedbmlDataContext  Data { get; set; }
        public TestApplication()
        {
            InitializeComponent();
            Data = new TestDatabasedbmlDataContext();
      
        }

        public void GetData(int a)
        {
            //Select All Records
            var queryAllCustomers = from cust in Data .tbl_Customers
                                    select cust;
            dataGridView1.DataSource = queryAllCustomers;

            //Using Where
            var querCustomersyWhere = from cust in Data.tbl_Customers
                                       where cust.CustomerID == 1
                                       orderby cust.CustomerName ascending
                                       select cust;
            //Using Order by
            var queryCustomersOrderBy = from cust in Data.tbl_Customers
                                       where cust.CustomerID == 1
                                       orderby cust.CustomerName ascending
                                       select cust;
            //Using Group by
            var queryCustomersGroupBy =  from cust in Data.tbl_Customers
                                            group cust by cust.CustomerName into custGroup
                                            where custGroup.Count() > 2
                                            orderby custGroup.Key
                                            select custGroup;

        }


        //Retrieve Data using SP
        public void Getdata()
        {
            var returnUser = (from c in Data.SP_GetCustomerRecords(1)
                              select new tbl_Customer
                              {
                                  CustomerID = c.CustomerID,
                                  CustomerName = c.CustomerName,
                                  Address = c.Address,
                                  Sex = c.Sex,
                                  TelephoneNo = c.TelephoneNo
                              }).ToList<tbl_Customer>();




        }

public void InsertData()
        {
          int? CustomerID=-1;
            //int CustomerID=-1;
            Data.SP_InsertCustomerRecords(ref CustomerID, "John", "Address", "Male", "0988999");
        }

n4� lm�V.�--grid-align:none;text-autospace:none'> 

        public void GetData(int a)
        {
            //Select All Records
            var queryAllCustomers = from cust in Data .tbl_Customers
                                    select cust;
            dataGridView1.DataSource = queryAllCustomers;

            //Using Where
            var querCustomersyWhere = from cust in Data.tbl_Customers
                                       where cust.CustomerID == 1
                                       orderby cust.CustomerName ascending
                                       select cust;
            //Using Order by
            var queryCustomersOrderBy = from cust in Data.tbl_Customers
                                       where cust.CustomerID == 1
                                       orderby cust.CustomerName ascending
                                       select cust;
            //Using Group by
            var queryCustomersGroupBy =  from cust in Data.tbl_Customers
                                            group cust by cust.CustomerName into custGroup
                                            where custGroup.Count() > 2
                                            orderby custGroup.Key
                                            select custGroup;

        }


        //Retrieve Data using SP
        public void Getdata()
        {
            var returnUser = (from c in Data.SP_GetCustomerRecords(1)
                              select new tbl_Customer
                              {
                                  CustomerID = c.CustomerID,
                                  CustomerName = c.CustomerName,
                                  Address = c.Address,
                                  Sex = c.Sex,
                                  TelephoneNo = c.TelephoneNo
                              }).ToList<tbl_Customer>();
        }



code

public TestDatabasedbmlDataContext  Data { get; set; }
        public TestApplication()
        {
            InitializeComponent();
            Data = new TestDatabasedbmlDataContext();
      
        }

        public void GetData(int a)
        {
            //Select All Records
            var queryAllCustomers = from cust in Data .tbl_Customers
                                    select cust;
            dataGridView1.DataSource = queryAllCustomers;

            //Using Where
            var querCustomersyWhere = from cust in Data.tbl_Customers
                                       where cust.CustomerID == 1
                                       orderby cust.CustomerName ascending
                                       select cust;
            //Using Order by
            var queryCustomersOrderBy = from cust in Data.tbl_Customers
                                       where cust.CustomerID == 1
                                       orderby cust.CustomerName ascending
                                       select cust;
            //Using Group by
            var queryCustomersGroupBy =  from cust in Data.tbl_Customers
                                            group cust by cust.CustomerName into custGroup
                                            where custGroup.Count() > 2
                                            orderby custGroup.Key
                                            select custGroup;

        }


        //Retrieve Data using SP
        public void Getdata()
        {
            var returnUser = (from c in Data.SP_GetCustomerRecords(1)
                              select new tbl_Customer
                              {
                                  CustomerID = c.CustomerID,
                                  CustomerName = c.CustomerName,
                                  Address = c.Address,
                                  Sex = c.Sex,
                                  TelephoneNo = c.TelephoneNo
                              }).ToList<tbl_Customer>();




        }

public void InsertData()
        {
          int? CustomerID=-1;
            //int CustomerID=-1;
            Data.SP_InsertCustomerRecords(ref CustomerID, "John", "Address", "Male", "0988999");
        }

n4 � l m �V. �- -grid-align:none;text-autospace:none'> 

        public void GetData(int a)
        {
            //Select All Records
            var queryAllCustomers = from cust in Data .tbl_Customers
                                    select cust;
            dataGridView1.DataSource = queryAllCustomers;

            //Using Where
            var querCustomersyWhere = from cust in Data.tbl_Customers
                                       where cust.CustomerID == 1
                                       orderby cust.CustomerName ascending
                                       select cust;
            //Using Order by
            var queryCustomersOrderBy = from cust in Data.tbl_Customers
                                       where cust.CustomerID == 1
                                       orderby cust.CustomerName ascending
                                       select cust;
            //Using Group by
            var queryCustomersGroupBy =  from cust in Data.tbl_Customers
                                            group cust by cust.CustomerName into custGroup
                                            where custGroup.Count() > 2
                                            orderby custGroup.Key
                                            select custGroup;

        }


        //Retrieve Data using SP
        public void Getdata()
        {
            var returnUser = (from c in Data.SP_GetCustomerRecords(1)
                              select new tbl_Customer
                              {
                                  CustomerID = c.CustomerID,
                                  CustomerName = c.CustomerName,
                                  Address = c.Address,
                                  Sex = c.Sex,
                                  TelephoneNo = c.TelephoneNo
                              }).ToList<tbl_Customer>();
        }



blogger templates | Make Money Online