using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient; namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
MySqlConnection Conn = new MySqlConnection("Database=admin;server=localhost;User Id=root;Password="); string sql = "select * from user";
MySqlCommand Da = new MySqlCommand(sql, Conn);
Conn.Open();
//MySqlDataAdapter ad = new MySqlDataAdapter();
MySqlDataReader re = Da.ExecuteReader();
//re.Read();
//DataSet a = new DataSet();
string username1 = this.username.Text.Trim();
string password1 = this.password.Text.Trim();
//string u1=re[1].ToString();
//string p1=re[2].ToString();
if (username1 == "" || password1 == "")
{
MessageBox.Show("用户名不能为空"); }
else {
if (re.Read()) { string u1 = re[1].ToString();
string p1=re[2].ToString();
if (username1 == u1 || password1 == p1)
{ MessageBox.Show("正确");
}
else { MessageBox.Show("密码错误");
} } } }
}
}

  

最新文章

  1. myhandle
  2. 第十四章:降维:奇异值分解SVD
  3. java 入门 第二季4
  4. SOLID面向对象的五个设计原则,留空待学习。
  5. sql*loader的直接加载方式和传统加载方式的性能差异
  6. ToolBar、ActionBar与Menu的纠葛(以及navigationIcon、setHomeButtonEnabled、setDisplayHomeAsUpEnabled)
  7. Asp.Net的两种开发方式
  8. 已知ip地址和其子网掩码如何求网络号子网号主机号
  9. ext 3.2 tree 在IE10中点击事件失效的bug
  10. 大文件读取方法(C#)
  11. 为何与0xff进行与运算
  12. 关于文件读写IDL
  13. 命令行分析组件IKende.CLI
  14. js 数组 map方法
  15. 《笨方法学Python》加分题1
  16. redis命令大全参考手册
  17. 网格视图GridView的使用
  18. golang redis集群操作:redis-go-cluster
  19. centos7 搭建keepalived+Nginx+tomcat
  20. 【转载】Impala和Hive的区别

热门文章

  1. Vue学习使用系列九【axiox全局默认配置以及结合Asp.NetCore3.1 WebApi 生成显示Base64的图形验证码】
  2. 基于Intel x86 Android的RAD游戏开发
  3. day53 Pyhton 前端04
  4. Nginx禁止html等缓存
  5. PHP SPL标准库-接口
  6. Pyrhon-OS库
  7. CAS 算法与 Java 原子类
  8. NET CORE WebAPI 搭建--基础搭建
  9. better-scroll 与 Vue 结合
  10. hibernate.cfg.xml 配置SQL server,MySQL,Oracle