读取下一条记录的问题
int i=-1;
DataSet ds = new DataSet();
private void Page_Load(object sender, System.EventArgs e)
{
this.sqlConnection1.Open();
this.sqlDataAdapter1.SelectCommand.CommandText = "select type from icp_server_location ";
this.sqlDataAdapter1.Fill(ds, "icp_server_location ");
}
private void Button1_Click(object sender, System.EventArgs e)
{
i+=1;
this.TextBox1.Text = ds.Tables[ "icp_server_location "].Rows[i][ "type "].ToString();
}
我本来打算每按一下显示下一条记录,但现在按了以后始终显示第一条记录,请问哪里不对劲?
[解决办法]
static 就是一个全局的静态变量了,这样的话不同的用户间会互相影响的,你可以同时打开两个网页试试看...