标题: Unity引擎链接mySQL数据库 [打印本页] 作者: star-小虎 时间: 2013-10-15 15:15 标题: Unity引擎链接mySQL数据库 using UnityEngine;
using System;
using System.Collections;
using System.Data;
using MySql.Data.MySqlClient;
public class CMySql : MonoBehaviour {
// Global variables
public static MySqlConnection dbConnection;//Just like MyConn.conn in StoryTools before
using UnityEngine;
using System;
using System.Collections;
using System.Data;
public class DataBaseTest : MonoBehaviour {
public GUISkin myGUISkin = new GUISkin();
string strID = "";
string strName = "";
string strSex = "";
int Index = 1;
// Use this for initialization
void Start () {
}
void OnGUI()
{
GUI.skin = myGUISkin;
if (GUI.Button(new Rect(100,320,100,100),"Click Me"))
{
foreach(DataRow dr in CMySql.MyObj.Tables[0].Rows)
{
if (Index.ToString() == dr["ID"].ToString())
{
strID = dr["ID"].ToString();
strName = dr["Name"].ToString();
strSex = dr["Sex"].ToString();