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 =
相关文档:
public partial class shujuku_huanyuan : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection(@"server=HUAZD-33\XXD33;uid=sa;pwd=111111;database=master;");
protected void Page_Load(object sender, EventArgs e)
&nbs ......
乱码真是个令人讨厌的问题~
刚才终于把MySQL与JSP交互的乱码问题解决了。
办法如下:
1.在url处加上句子 "&useUnicode=true&characterEncoding=GBK" ;
2.我用Navicat Lite可视化工具创建MySQL数据库时,可选定数据库编码,也是 GBK ;
3.页面的编码可以选GBK以外的编码方式,如UTF-8。若操作页面的编码是UTF- ......
数据仓库之父Bill Inmon在1991年出版的“Building the Data
Warehouse”一书中所提出的定义被广泛接受——数据仓库(Data Warehouse)是一个面向主题的(Subject
Oriented)、集成的(Integrated)、相对稳定的(Non-Volatile)、反映历史变化(Time
Variant)的数据集合,用于支持管理决策(D ......
drop procedure if exists pro_rep_shadow_rs;
delimiter |
----------------------------------
-- rep_shadow_rs
-- 用来处理信息的增加,更新和删除
-- 每次只更新上次以来没有做过的数据
-- 根据不同的标志位
-- 需要一个输出的参数,
-- 如果返回为0,则调用失败,事务回滚
-- 如 ......
一.字符串类
CHARSET(str) //返回字串字符集
CONCAT (string2 [,... ]) //连接字串
INSTR (string ,substring ) //返回substring首次在string中出现的位置,不存在返回0
LCASE (string2 ) //转换成小写
LEFT (string2 ,length ) //从string2中的左边起取length个字符
LENGTH (string ) //string长度
LO ......