用户表浏览.aspx.cs
来自「学生管理系统 功能不是很强大 但是很实用」· CS 代码 · 共 42 行
CS
42 行
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
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 用户表浏览 : System.Web.UI.Page
{
public
DataRow dtr;
SqlDataAdapter myadapter;
SqlCommandBuilder scb;
DataSet myDataSet;
SqlConnection mysqlconnection;
int returnValue;
protected void Page_Load(object sender, EventArgs e)
{
String sqlconn = "data source=.;database=学生成绩智能管理系统;user id=sa;password=sa;";
mysqlconnection = new SqlConnection(sqlconn);
SqlCommand mysqlcommand = mysqlconnection.CreateCommand();
mysqlcommand.CommandText = "select 用户名,备注 from 用户表";
myadapter = new SqlDataAdapter();
myadapter.SelectCommand = mysqlcommand;
myDataSet = new DataSet();
mysqlconnection.Open();
int numberOfRow = myadapter.Fill(myDataSet, "用户表");
this.GridView1.DataSource = new DataView(myDataSet.Tables["用户表"]);
this.GridView1.DataBind();
Label1.Text = "共有" +numberOfRow+"名用户";
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?