Unity3D 教程:两种方法连接 MySql 数据库
Posted on 2013 年 06 月 27 日 by U3d / Unity3D 基础教程/被围观 14 次
1、用 MySQLDriverCS 连接 MySQL 数据库
先下载和安装 MySQLDriverCS,在安装文件夹下面找到 MySQLDriver.dll,然后将
MySQLDriver.dll 添加引用到项目中。
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
public partial class Form1 : Form
private void Form1_Load(object sender, EventArgs e)
//Unity3D
教程手册:
www.unitymanual.com
MySQLConnection conn = null;
conn = new MySQLConnection(new
MySQLConnectionString("localhost", "inv", "root", "831025").AsString);
//Unity3D
教程手册:
www.unitymanual.com
MySQLCommand commn = new MySQLCommand("set names gb2312",
conn);
string sql = "select * from exchange ";
MySQLDataAdapter mda = new MySQLDataAdapter(sql, conn);
DataSet ds = new DataSet();
评论0