纳金网

标题: NGUI-----poplist值的获取代码(可操作控制数据库) [打印本页]

作者: 王者再临    时间: 2014-12-31 22:03
标题: NGUI-----poplist值的获取代码(可操作控制数据库)
  1. using UnityEngine;

  2. using System.Collections;

  3. using System.Data;

  4. public class poplist : MonoBehaviour {

  5. public UILabel lab;

  6. // Use this for initialization

  7. void Start () {

  8. }

  9. MysqlDbAccess mydb=new MysqlDbAccess ();

  10. // Update is called once per frame

  11. void Update () {

  12. }

  13. void OnSelectionChange (string val)

  14. {

  15. //  Debug.Log(“OnSelect”+val);

  16. switch (val)

  17. {

  18. case “显示1”: lab.text=“数字1”; break;

  19. //case “显示2”:    lab.text=“数字2”; break;

  20. case “显示2”:    Application.LoadLevel(3); break;

  21. case “显示3”: IDataReader reader1=mydb.doQuery(“select id from member where name='lmm‘”);

  22. if (reader1.Read()){

  23. Debug.Log(“查询成功”);}

  24. else Debug.Log(“查询失败”);

  25. break;

  26. case “显示4”: bool b1=mydb.ist(“insert into member(name,password) values('zp','123')”);

  27. mydb.closeSqlConnection(); Debug.Log(“插入成功”); break;

  28. }

  29. }

  30. }
复制代码





欢迎光临 纳金网 (http://c-www.narkii.com/club/) Powered by Discuz! X2.5