unity3d 使用sqlite数据库

前端之家收集整理的这篇文章主要介绍了unity3d 使用sqlite数据库前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
   //创建数据库名称为xuanyusong.db
  DbAccess db = new DbAccess("data source=horsegame.db");
  try{
   print("fdsfgdgdsafgdsagda");
   //请注意 插入字符串是 已经要加上'宣雨松' 不然会报错
   //db.CreateTable("datainfo",new string[]{"name","equipNo","colorType","status","scores"},new string[]{"TEXT","INTEGER","TEXT"});
//   db.InsertInto("datainfo",new string[]{ "'equip1'","0","1","200"  });
//   db.InsertInto("datainfo",new string[]{ "'equip2'","400"  });  
   //注解1
   //sqliteDataReader sqReader = db.SelectWhere("datainfo","colorType"},new string[]{"equipNo"},new string[]{"="},new string[]{"0"});
   sqliteDataReader sqReader = db.ReadFullTable("datainfo");
   string strVal;
   int nVal;
   int i = 0;
   while (sqReader.Read())  
      { 
         Debug.Log(sqReader.GetString(sqReader.GetOrdinal("name")) + sqReader.GetString(sqReader.GetOrdinal("scores"))); 
       pro = new Property();
    nVal = sqReader.GetInt32(sqReader.GetOrdinal("equipNo"));
    pro.m_nEno = nVal;
    nVal = sqReader.GetInt32(sqReader.GetOrdinal("colorType"));
    pro.m_colorType = (ColorType)nVal;
    nVal = sqReader.GetInt32(sqReader.GetOrdinal("status"));
    pro.m_bStatu = nVal;
    strVal = sqReader.GetString(sqReader.GetOrdinal("scores"));
    m_score = System.Convert.ToInt32(strVal);
    AddEquipProperty(strEquipName[i],pro);
    ++i;
   } 
   
   db.ClosesqlConnection();
  }
  catch(sqliteException e){
   db.ClosesqlConnection();
  }

猜你在找的Sqlite相关文章