关于mysql-connector-net和C#.net

using System;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
/*
本程序使用 MySql.Data.dll 链接Mysql数据库,读取服务器中所有数据库的名称,显示在界面上。HoverTree
*/ namespace MysqlHoverTree
{
public partial class Form1 : Form
{ private MySqlConnection _conn; public Form1()
{
InitializeComponent();
} private void button_connect_Click(object sender, EventArgs e)
{
if (_conn != null)
_conn.Close(); string h_connString = "server=localhost;user id=root; password=123456; port=3306; database=mysql; pooling=false; charset=utf8";//根据实际修改 try { _conn = new MySqlConnection(h_connString); _conn.Open(); GetDatabases(); MessageBox.Show("连接数据库成功!"); } catch (MySqlException ex) { MessageBox.Show("Error connecting to the server: " + ex.Message); }
} private void GetDatabases() { MySqlDataReader reader = null; MySqlCommand cmd = new MySqlCommand("SHOW DATABASES", _conn); try { reader = cmd.ExecuteReader(); listBox_database.Items.Clear(); while (reader.Read()) { listBox_database.Items.Add(reader.GetString()); } } catch (MySqlException ex) { MessageBox.Show("Failed to populate database list: " + ex.Message); } finally { if (reader != null) reader.Close(); } } }
}
关于mysql-connector-net和C#.net的更多相关文章
- 创建ASP.NET Core MVC应用程序(2)-利用MySQL Connector NET连接到MySQL
创建ASP.NET Core MVC应用程序(2)-利用MySQL Connector NET连接到MySQL 用惯.NET的研发人员都习惯性地使用SQLServer作为数据库.然而.NET Core ...
- vc++2013中使用MySQL connector/C++ 1.1.4静态链接报错
包含头文件 #include <mysql_connection.h> #include <mysql_driver.h> #include <cppconn/state ...
- Using MySQL Connector .NET 6.6.4 with Entity Framework 5
I had been waiting for the latest MySQL connector for .NET to come out so I can move on to the new a ...
- [转]MySQL Connector/C++(一)
http://www.cnblogs.com/dvwei/archive/2013/04/18/3029464.html#undefined#undefined MySQL Connector/C++ ...
- mysql.connector操作mysql的blob值
This tutorial shows you how to work with MySQL BLOB data in Python, with examples of updating and re ...
- Ubuntu & MacOS安装Mysql & connector
Ubuntu & MacOS安装Mysql & connector 1. 安装MySql sudo apt-get install mysql-server apt-get insta ...
- Snippet: Fetching results after calling stored procedures using MySQL Connector/Python
https://geert.vanderkelen.org/2014/results-after-procedure-call/ Problem Using MySQL Connector/Pytho ...
- MySQL Connector/J 6.x jdbc.properties 配置, mysql-connector-java-6.0.4.jar 异常
今天学习SSM框架整合,完成Spring和mybatis这两大框架的整合做测试时候出来很多问题,主要来自于配置文件. 我这里重点说一下Mysql数据驱动配置. 配置pom.xml时候去网站 MySQL ...
- mybatis/callablestatement调用存储过程mysql connector产生不必要的元数据查询
INFO | jvm 1 | 2016/08/25 15:17:01 | 16-08-25 15:17:01 DEBUG pool-1-thread-371dao.ITaskDao.callProce ...
- 在CentOS里使用MySQL Connector/C++
操作系统版本:CentOS6 64位 1,安装boost库.因为MySQL Connector/C++使用了boost库,所以必须先安装boost库,我们才能使用MySQL Connector/C++ ...
随机推荐
- tyflow birth节点
0-50帧,持续出生5颗粒子,若范围为0-0,5颗粒子将在第一帧全部出生 每一帧出生5颗粒子,直到50帧结束 连续发射,在0-500帧范围内,每5颗粒子出生后,继续出生5颗 5颗粒子出生后持续50帧, ...
- Flutter 读写本地文件
文档 注意 安装 path_provider 插件后重启f5, 而不是等待热更新 demo import 'dart:io'; import 'dart:async'; import 'package ...
- phpstorm 断点调试 傻瓜教程
前言: 简单介绍下为什么要用断点调试,很多人说我在代码调试的部位用var_dump 或者 exit 或者print_r来进行断点,但是当项目足够大的时候这样的做法就比较费时费力,因为你断点后需要删除原 ...
- hadoop源码分析(2):Map-Reduce的过程解析
一.客户端 Map-Reduce的过程首先是由客户端提交一个任务开始的. 提交任务主要是通过JobClient.runJob(JobConf)静态函数实现的: public static Runnin ...
- QEMU KVM Libvirt手册(10): KVM的各种限制
Overcommits KVM allows for both memory and disk space overcommit. However, hard errors resulting fro ...
- 急急如律令!火速搭建一个C#即时通信系统!(附源码分享——高度可移植!)
(2016年3月更:由于后来了解到GGTalk开源即时通讯系统,因此直接采用了该资源用于项目开发,在此对作者表示由衷的感谢!) —————————————————————————————————— 人 ...
- Dubbo工作原理,集群容错,负载均衡
Remoting:网络通信框架,实现了sync-over-async和request-response消息机制. RPC:一个远程过程调用的抽象,支持负载均衡.容灾和集群功能. Registry:服务 ...
- [Swift]LeetCode327. 区间和的个数 | Count of Range Sum
Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive.Ra ...
- 【dotNet Core】Swagger下简单的给WebApi分组
Startup.cs下ConfigureServices代码 这里主要在DocInclusionPredicate控制输出那些api. Startup.cs下Configure代码 给Controll ...
- JVM虚拟机(1)---常用JVM配置参数
常用JVM配置参数 常用JVM配置参数主要有:Trace跟踪参数.堆的分配参数.栈的分配参数. 一.Trace跟踪参数 跟踪参数用于跟踪监控JVM,对于开发人员来讲用于JVM调优以及故障排查的. 1. ...