C#连接MySql数据库方法
宇兰
1、用MySQLDriverCS连接MySQL数据库
先下载和安装MySQLDriverCS,地址:http://sourceforge.net/projects/mysqldrivercs/在安装文件夹下面找到MySQLDriver.dll,然后将MySQLDriver.dll添加引用到项目中注:我下载的是版本是 MySQLDriverCS-n-EasyQueryTools-4.0.1-DotNet2.0.exe using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.Odbc;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using MySQLDriverCS; namespace mysql{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { MySQLConnection conn = null; conn = new MySQLConnection(new MySQLConnectionString("localhost", "inv", "root", "831025").AsString); conn.Open(); MySQLCommand commn = new MySQLCommand("set names gb2312", conn); commn.ExecuteNonQuery(); string sql = "select * from exchange "; MySQLDataAdapter mda = new MySQLDataAdapter(sql, conn); DataSet ds = new DataSet(); mda.Fill(ds, "table1"); &n
相关文档:
protected void Page_Load(object sender, EventArgs e)
{
try
{
&nbs ......
http://www.blogjava.net/Alpha/archive/2007/07/23/131912.html
//主键549830479
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//增加一个新列549830479
alter table t2 add d timestamp;
alter table infos add ex tinyint n ......
作者:andyao
原文link: http://andyao.javaeye.com/admin/show/144033
转载请留名
1. 简介
在Web应用程序体系架构中,数据持久层(通常是一个关系数据库)是关键的核心部分,它对系统的性能有非常重要的影响。MySQL是目前使用最多的开源数据库,但是MySQL数据库的默认设置性能非常的差,仅仅是一个玩具数据库。因此在 ......
mysql停止命令
bin/mysqladmin -uroot -p shutdown
mysql启动命令
bin/mysqld_safe &
mysql 修改root密码
1.停止mysql服务
2.启动mysql服务时附加参数
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3.以root进入mysql
mysql -u root mysql
4.执行sql语句
mysql> UPDATE user S ......
#include "winsock.h"
#include "mysql.h"
void query_example(void)
{
MYSQL *pDbCon = NULL;
char *pszHost = "localhost";
char *pszUser = "guest";
char *pszPsw = "";
char *pszDbName = "mysql_db_name";
int iPort = 3306;
pDbCon = mysql_init((MYSQL*) 0);
if (NULL != pDbCon)
{
......