Unity3D如何使用Sqlite数据库
来源:互联网 发布:炫舞辅助源码 编辑:程序博客网 时间:2024/06/11 20:09
1,需要用到这几个dll文件:Mono.Data.Sqlite.dll和sqlite3.dll和Mono.Data.SQLiteClient.dll
2,将这几个dll文件放在Plugins下,必须放这里。
3,在Player Setting里的 OtherSettings里有个Optimization 下边的API Compatbility Level 选择.NET 2.0。
4,添加个SQLiteHelper类。这个网上有,当然也可以自己写 - -!
5,数据库要放在 StreamingAssets这个文件夹下。
5,剩下的就是操作了
随便写点代码:
[code]csharpcode:
01
using
UnityEngine;
02
using
System.Collections;
03
using
System.Collections.Generic;
04
using
System;
05
using
System.Data;
06
using
Mono.Data.SqliteClient;
07
using
System.Text;
08
using
System.IO;
09
10
public
class
DBHelp : MonoBehaviour {
11
static
string
conn=
string
.Empty;
12
// Use this for initialization
13
14
public
static
string
getConstr()
//得到字符串
15
{
16
17
18
#if UNITY_EDITOR
19
conn =
"URI=file:"
+ Application.dataPath +
"/StreamingAssets/KLandNG.db"
;
20
21
22
23
#elif UNITY_ANDROID
24
25
26
conn =
"URI=file:"
+ Application.persistentDataPath +
"/"
+
"daniya.db"
;
27
28
#endif
29
30
31
return
conn;
32
}
33
34
public
static
bool
UpdateScoll()
35
{
36
int
i = SqliteHelper.ExecuteNonQuery(getConstr(), CommandType.Text,
37
"update ItemInfo set name ='haha' where Type =1;"
38
39
);
40
return
i > 0;
41
42
43
44
45
}
46
}
0 0
- Unity3D如何使用Sqlite数据库
- Unity3D如何使用Sqlite数据库
- unity3d 使用sqlite数据库
- Python:如何使用SQLite数据库
- Unity3d 读取 Sqlite数据库
- 如何解决 Unity3D 引用 SQLite 数据库类不能发布可执行文件
- unity3d,C#使用sqlite作为数据库解决方案思路
- Unity3D Sqlite使用
- Unity3D使用SQLite
- Unity3D+SQLite的使用
- 如何使用c#操作SQLite数据库
- android开发如何使用SQLite数据库教程
- 如何在Java中使用SQLite数据库
- Android如何使用JDBC连接SQLite数据库?
- iOS如何优雅的使用sqlite数据库
- C#中如何使用SQLite数据库
- Unity3D之SQLite的使用
- 如何使用SQLite数据库,android SQLiteOpenHelper使用实例
- Java keytool 的使用 及证书的处理
- wp8获取当前页面
- This application has requested the Runtime to terminate it in an unusual way
- Data Set
- Android ViewPager使用详解
- Unity3D如何使用Sqlite数据库
- 安卓浅析
- 2013年第四季度财报
- wp8退出程序
- JavaSE 反射 (进阶)
- Java IO流与对象IO序列化
- VSS 2005 客户端和服务器端配置总结
- 千里之行始于足下。
- 本地化处理 轻松支持多国语言