代码拉取完成,页面将自动刷新
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace QQ2020
{
public partial class FrmAddUser : Form
{
public FrmAddUser()
{
InitializeComponent();
}
MysqlDB mysqlDB;
private void FrmAddUser_Load(object sender, EventArgs e)
{
//初始化
mysqlDB = new MysqlDB();
string sql = "select * from qquser where name!='" + FrmLogin.loginName + "'";
var reader = mysqlDB.Get(sql);
while (reader.Read())
{
UserList userList = new UserList();
userList.UserName = reader.GetString("name");//用户名
userList.UserEmail = reader.GetString("email");//邮箱
flowLayoutPanel1.Controls.Add(userList);
}
}
private void picSearch_MouseEnter(object sender, EventArgs e)
{
ToolTip p = new ToolTip();
p.ShowAlways = true;
p.SetToolTip(this.picSearch, "查询用户");
picSearch.BackColor = Color.AliceBlue;
}
private void picSearch_Click(object sender, EventArgs e)
{
if (textName.Text != "") {
flowLayoutPanel1.Controls.Clear();
string sql = "select * from qquser where name='" + textName.Text + "'";
var reader = mysqlDB.Get(sql);
if (!reader.HasRows) {
while (reader.Read())
{
UserList userList = new UserList();
userList.UserName = reader.GetString("name");//用户名
userList.UserEmail = reader.GetString("email");//邮箱
flowLayoutPanel1.Controls.Add(userList);
}
}
else
{
MessageBox.Show("无此用户");
}
}
else
{
FrmAddUser_Load(null, null);
}
}
private void picSearch_MouseLeave(object sender, EventArgs e)
{
picSearch.BackColor = Color.Transparent;
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。