3 Star 5 Fork 4

W-Kinlon/WithMe

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
FrmAddUser.cs 2.38 KB
一键复制 编辑 原始数据 按行查看 历史
lumache 提交于 2020-12-23 15:28 . 优化代码
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;
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/W-Kinlon/WithMe.git
git@gitee.com:W-Kinlon/WithMe.git
W-Kinlon
WithMe
WithMe
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385