- 最后登录
- 2019-12-2
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 34660
  
- 纳金币
- 38268
- 精华
- 111
|
using UnityEngine;
using System.Collections;
using Mono.Data.Sqlite;
public class SQLTest : MonoBehaviour {
// Use this for initialization
void Start () {
string dbPath = Application.dataPath+"/GameDB.sqlite";
//1.链接数据库
SqliteConnection connect = new SqliteConnection("Data Source="+dbPath);
//2.打开数据库
connect.Open();
//3.创建数据库指令对象
SqliteCommand command = connect.CreateCommand();
//4.执行SQLite语句
command.CommandText = "";
command.ExecuteNonQuery();
//4.5 . 获取查询结果
SqliteDataReader reader = command.ExecuteReader();
while ( reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
{
string name= reader.GetName(i);
string value = reader.GetString(i);
}
}
connect.Close();
}
}
|
|