- 最后登录
- 2019-12-25
- 注册时间
- 2012-8-24
- 阅读权限
- 90
- 积分
- 71088
- 纳金币
- 52304
- 精华
- 343
|
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();
}
}
|
|