纳金网
标题:
NGUI-----poplist值的获取代码(可操作控制数据库)
[打印本页]
作者:
王者再临
时间:
2014-12-31 22:03
标题:
NGUI-----poplist值的获取代码(可操作控制数据库)
using UnityEngine;
using System.Collections;
using System.Data;
public class poplist : MonoBehaviour {
public UILabel lab;
// Use this for initialization
void Start () {
}
MysqlDbAccess mydb=new MysqlDbAccess ();
// Update is called once per frame
void Update () {
}
void OnSelectionChange (string val)
{
// Debug.Log(“OnSelect”+val);
switch (val)
{
case “显示1”: lab.text=“数字1”; break;
//case “显示2”: lab.text=“数字2”; break;
case “显示2”: Application.LoadLevel(3); break;
case “显示3”: IDataReader reader1=mydb.doQuery(“select id from member where name='lmm‘”);
if (reader1.Read()){
Debug.Log(“查询成功”);}
else Debug.Log(“查询失败”);
break;
case “显示4”: bool b1=mydb.ist(“insert into member(name,password) values('zp','123')”);
mydb.closeSqlConnection(); Debug.Log(“插入成功”); break;
}
}
}
复制代码
欢迎光临 纳金网 (http://rs.narkii.com/club/)
Powered by Discuz! X2.5