*怎样查询数据库中的数据?

来源:百度知道 编辑:UC知道 时间:2024/06/03 06:13:17
是SQL,谢谢!

private void btnSearch_Click(object sender, EventArgs e)
{
if (txtLoginId.Text == "") // 必须输入用户名才能查找
{
MessageBox.Show("请输入用户名", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtLoginId.Focus();
}
else // 查找用户
{
FillListView(); // 填充列表视图
}
}
private void FillListView()
{
string loginId; // 用户名
string studentName; // 姓名
string studentNO; // 学号
int userStateId; // 用户状态Id
string userState; // 用户状态

// 查找学员用户的sql语句
string sql = string.Format(
"SELECT StudentID,LoginId,StudentNO,StudentName,UserStateId FROM Student WHERE LoginId like '%{0}%'", txtL