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 =
相关文档:
今天做项目的时候,将null传入Oracle的表中,就是不成功
经过尝试得出了两个解决方案:
1.传入OracleDateTime.NULL
2.Nullable<DateTime> optime = DBNull.Value; 传入optime(开始网上找的答案是Nullable<DateTime> optime = null发现还是会报错) ......
protected void btnsearch_ServerClick(object sender, EventArgs e)
{
string lujing=this.Text2.Value.ToString().Trim();
string shujuku = this.jine.Value;
&nbs ......
需要引用的类名空间
using System.Security.Cryptography;
using System.IO;
using System.text;
/// <summary>
/// 加密
// ......
PHP访问MySQL数据库函数简介
1. 进行数据库连接
连接数据库服务器,就是客户端向己运行的数据库服务器发出连接请求,
成功以后就可以对数据库进行相应操作,由于用户的权限不同,所能进
行的操作也不一样。PHP提供了一系列MySQL ......