This effect has long been achieved and has never been implemented. Today I took some time to do this. Finally, it is done.
Front-end code:
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default2.aspx. cs" inherits = "default2" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">
Background code:
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Data.SqlClient;public partial class Default2 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(); conn.ConnectionString = "server=10.68.69.203,81;database=cpudata;user id=sa;password=19790601"; try { conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT top 888 pur_voice, term_code, oper_code pur_date, user_code, meter_num, price_code, pur_power ,pur_money, pur_count, free_power, offer_money, left_money, write_card_pow FROM dbo.pur_power_detail;"; SqlDataAdapter sda = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); sda.Fill(ds); this.GridView1.DataSource = ds.Tables[0]; this.GridView1.DataBind(); } catch (Exception ex) { throw ex; } finally { conn.Close(); } } }