当前页的问题!希望高手们指点迷津,谢谢了!(在线等)
cs:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Data.SqlTypes;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
public int rscot;
String s;
//int num;
protected void Page_Load(object sender, EventArgs e)
{
BindData();
}
protected void BindData()
{
string txt = TextBox1.Text;
string connectionString = ConfigurationManager.ConnectionStrings[ "ConnectionString "].ConnectionString; //得到配置节
SqlConnection DBConnection = new SqlConnection(connectionString); //创建连接
string sqlStr = "select * from scrbtep where scid like ' " + txt + "% ' ";
SqlDataAdapter daGetData = new SqlDataAdapter(sqlStr, DBConnection);
DataSet dsData = new DataSet();
daGetData.Fill(dsData);
GridView1.DataSource = dsData;
rscot = dsData.Tables[0].Rows.Count;
GridView1.DataKeyNames = new string[] { "id " }; //主键
GridView1.DataBind();
daGetData.Dispose();
DBConnection.Close();
DBConnection.Dispose();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}
protected void Button1_Click(object sender, System.EventArgs e)
{