关于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++ ...
随机推荐
- 【转】线段树完全版~by NotOnlySuccess
线段树完全版 ~by NotOnlySuccess 很早前写的那篇线段树专辑至今一直是本博客阅读点击量最大的一片文章,当时觉得挺自豪的,还去pku打广告,但是现在我自己都不太好意思去看那篇文章了,觉 ...
- pycharm 中 django 导入静态文件不提示补全
File—>setting----->Languages & Frameworks ------> Python Template Languages ------> ...
- Windows 查询端口占用
1.找到端口的进程ID(PID)(例如:8080) Windows系统: netstat -ao | find " Windows以外的其他平台: lsof -i: 2.杀死你找到的进程ID ...
- 通过ffi在node.js中调用动态链接库[转]
http://blog.csdn.net/zhulin2609/article/details/51474676
- android 2018 面试题
四大组件:activity.service.content provider.broadcast receiver [一]Activity 1.生命周期 onCreate:表示activity正在被创 ...
- 多个router和多个network
一般搭建成功了opentack后,都会按照文档的这样创建网络 Scenario 1: one tenant, two networks, one router Scenario 2: two tena ...
- SQL Server Cast、Convert数据类型转换
一.概述 本篇文章转载来着官网在线文档,文章主要介绍SQL Server数据类型转换相关语法.隐式转换.Date样式等. 语法 Syntax for CAST: CAST ( expression A ...
- 微信小程序 open-data更改样式 open-data 显示头像 圆形
废话不多说,直接看效果: 效果一: 代码如下: <view class='zhubo'> <view class='zhuboLeft'> <view class='zh ...
- [Swift]LeetCode591. 标签验证器 | Tag Validator
Given a string representing a code snippet, you need to implement a tag validator to parse the code ...
- [Swift]LeetCode605. 种花问题 | Can Place Flowers
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, ...