Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
             * String sqlStatement = "select Id AS 'Order', CEOName AS CEO, CompanyName AS 'Company Name', Age, Asset AS 'Asset (million dollars)', ";
             * sqlStatement += " CONVERT(VARCHAR(10), DoB, 103) AS 'Date of birth (DD/MM/YYYY)' from CEOs ";
             *
             * loadGridView(sqlStatement);
             */

            CEOsView.DataSource = null;
            CEOsView.DataBind();
        }
Esempio n. 2
0
        protected void loadGridView(String sqlStatement)
        {
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\SocialNetworks.mdf;Integrated Security=True");

            SqlCommand cmd = new SqlCommand(sqlStatement, con);

            con.Open();

            SqlDataReader wan = cmd.ExecuteReader();

            CEOsView.DataSource = wan;

            CEOsView.DataBind();

            con.Close();
        }