关于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++ ...
随机推荐
- linux android开发环境搭建
android开发环境搭建的一些有用链接:1.sdk manager的国内服务器http://www.cnblogs.com/huangjacky/p/4077982.html2.常见问题的解决htt ...
- redis消息队列,tp5.0,高并发,抢购
redis处理抢购,并发,防止超卖,提速 1.商品队列(List列表),goods_list 控制并发,防止超卖 2.订单信息(Hash集合),order_info ...
- 「深度剖析」程序员因为奇葩需求暴打pm,然后被双双开除
想必大家都听说了,这两天关于中国平安一个产品经理因奇葩需求和程序员爆发肢体冲突的事件在朋友圈被刷屏,更有现场打架视频在技术群里疯传. 在这里先带大家简单文字回顾下事情经过,N次打架视频和截图就不给大家 ...
- cadence焊盘及元件封装制作
前面学习了元件封装的制作,由于琐碎事情的耽误,加上学习python,没有及时的总结这部分内容,现在做一个补充!
- Lesson 25 Do the English speak English?
Text I arrived London at last. The railway station was big, black and dark. I did not know the way t ...
- Android OpenGL ES 开发(七): OpenGL ES 响应触摸事件
像旋转三角形一样,通过预设程序来让对象移动对于吸引注意是很有用的,但是如果你想让你的OpenGL图形有用户交互呢?让你的OpenGL ES应用有触摸交互的关键是,扩展你的GLSurfaceView的实 ...
- 音视频编解码技术(二):AAC 音频编码技术
一.AAC编码概述 AAC是高级音频编码(Advanced Audio Coding)的缩写,出现于1997年,最初是基于MPEG-2的音频编码技术,目的是取代MP3格式.2000年,MPEG-4标准 ...
- [Swift]LeetCode565. 数组嵌套 | Array Nesting
A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest ...
- Linux 工程向 Windows 平台迁移的一些小小 tips
Linux 工程向 Windows 平台迁移的一些小小 tips VS2013 C++11 Visual Studio 2013 没有做到对 C++11 所有的支持,其中存在的一个特性就是 In-cl ...
- 机器学习入门16 - 多类别神经网络 (Multi-Class Neural Networks)
原文链接:https://developers.google.com/machine-learning/crash-course/multi-class-neural-networks/ 多类别分类, ...