用mysql数据库开发Windows应用程序 [英] developing windows applications with mysql database

查看:120
本文介绍了用mysql数据库开发Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用MySQL数据库进行快速开发,我想从简单的应用程序开始(不是太简单)..我想要一些示例来帮助我..任何人都可以帮助我..


在此先感谢,

hi all,

i am using sharp develop with mysql database , i want to start off with simple applications(not too simple)..i want some examples to help me out..can anyone please help me out..


thanks in advance,

推荐答案

This [^] could help you get started.


使用 ^ ] .

将引用添加到MySQL dll.

然后,您可以开始执行SQL调用.
Start by using MySQL Connector/Net[^].

Add a ref to MySQL dll.

Then you can start doing SQL calls.
System.Data.Common.DbConnection sqlConnection = new MySql.Data.MySqlClient.MySqlConnection("server=localhost;user id=sqlaccess;password=sqlpass;database=testdb;");
try
{
  string sql = string.Format("UPDATE tb1 SET type=''12'' WHERE id=2");
  sqlConnection.Open();
  System.Data.Common.DbCommand sqlCommand = sqlConnection.CreateCommand();
  sqlCommand.CommandText = sql;
  sqlCommand.ExecuteNonQuery();
  sqlConnection.Close();
}
catch (Exception ex)
{
  MessageBox.Show("Ups, exception: " + ex.Message);
}
finally
{
  sqlConnection.Close();
}



玩得开心:-)



Have fun :-)


我更喜欢使用MySQL Connector/Net,它可以下载此处 [ ^ ].在MySQL网站此处 [
I prefer to use MySQL Connector/Net which can be downloaded Here[^]. There are also good tutorials on the MySQL site Here[^]

Hope this helps


这篇关于用mysql数据库开发Windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆