예제 #1
0
        /// <summary>
        /// method name:Grid_Fill
        /// Description: Fill and bind the Gridview
        /// Author:bhumi
        /// Created On:8/6/2015
        /// </summary>
        public void Grid_Fill()
        {
            StringBuilder strBrSelectQuery;//string builder for query

            try
            {
                objconstmsg = new ConstantMessages();
                //insert SQLquery in String builder
                strBrSelectQuery = new StringBuilder("SELECT EmployeeID,TitleOfCourtesy,FirstName,LastName,");
                strBrSelectQuery.Append("CONVERT(nvarchar,BirthDate,110) AS BirthDate,City,Country,HomePhone");
                strBrSelectQuery.Append(" FROM");
                strBrSelectQuery.Append(" Employees;");
                //connection generation and read the data from reader
                objcmnfunction = new CommanFunction();
                //datatable
                dtEmployees = new DataTable();
                dtEmployees = objcmnfunction.ConnectionGenerate(strBrSelectQuery.ToString());
                //store data in grid view
                gvEmployees.DataSource = dtEmployees;
                gvEmployees.DataBind();
            }
            catch (Exception)
            {
                Response.Redirect(objconstmsg.strerrorpage);
            }
            finally
            {
                strBrSelectQuery = null;
                dtEmployees      = null;
                objconstmsg      = null;
            }
        }
예제 #2
0
        /// <summary>
        /// method name:Grid_Fill
        /// Description: Fill and bind the Gridview
        /// Author:bhumi
        /// Created On:9/6/2015
        /// </summary>
        public void Grid_Fill()
        {
            StringBuilder strBrSelectQuery;//string builder for query

            try
            {
                objconstmsg = new ConstantMessages();
                //insert SQLquery in String builder
                strBrSelectQuery = new StringBuilder("SELECT CustomerID,CompanyName,ContactTitle,City,PostalCode,Phone,Fax");
                strBrSelectQuery.Append(" FROM");
                strBrSelectQuery.Append(" Customers;");
                //connection generation and read the data from reader
                objcmnfunction = new CommanFunction();
                //datatable
                dtCustomers = new DataTable();
                dtCustomers = objcmnfunction.ConnectionGenerate(strBrSelectQuery.ToString());
                //store data in grid view
                gvCustomers.DataSource = dtCustomers;
                gvCustomers.DataBind();
            }
            catch (Exception)
            {
                Response.Redirect(objconstmsg.strerrorpage, false);
            }
            finally
            {
                strBrSelectQuery = null;
            }
        }
예제 #3
0
        /// <summary>
        /// method name:Grid_Fill
        /// Description: Fill and bind the Gridview
        /// Author:bhumi
        /// Created On:10/6/2015
        /// </summary>
        public void Grid_Fill()
        {
            StringBuilder strBrSelectQuery;//string builder for query

            try
            {
                objconstmsg = new ConstantMessages();
                //insert SQLquery in String builder
                strBrSelectQuery = new StringBuilder("SELECT EmployeeID,TerritoryID");
                strBrSelectQuery.Append(" FROM");
                strBrSelectQuery.Append(" EmployeeTerritories;");
                //connection generation and read the data from reader
                objcmnfunction = new CommanFunction();
                //datatable
                dtEmployees = new DataTable();
                dtEmployees = objcmnfunction.ConnectionGenerate(strBrSelectQuery.ToString());
                //store data in grid view
                gvEmployeeTerritory.DataSource = dtEmployees;
                gvEmployeeTerritory.DataBind();
            }
            catch (Exception)
            {
                Response.Redirect(objconstmsg.strerrorpage);
            }
            finally
            {
                strBrSelectQuery = null;
                dtEmployees      = null;
                objconstmsg      = null;
            }
        }