SQLite connection Problem via /r/learnprogramming


SQLite connection Problem

Hey guy's. So I have been cursing and trowing with my laptop across the room and after 2 weeks it is still not working in the slightest. It works well on PC but It must work on android as I am developing an android game.

So this should create and connect to an sqlite database. On the pc it creates the database and every command works fine. But on Android it doesn't even want to connect and I'm out of idea's how I can make this thing work :/ Anybody can help?

I think it has something to do with IDbConnection, IDbCommand and IDataReader. But not sure how to change it or if that even causes the problem

using UnityEngine; using System.IO; using System.Data; public class WhilstEntering : MonoBehaviour { private static string _sqlDBLocation = ""; private const string SQL_DB_NAME = "PlayerDB"; /// DB objects private IDbConnection _connection = null; private IDbCommand _command = null; private IDataReader _reader = null; private string _sqlString; private bool _createNewTavle = false; void Awake() { _sqlDBLocation = "URI=file:" + Application.persistentDataPath + "/" + SQL_DB_NAME + ".db"; SaveDataText.SetActive(true); SQLiteInit(); } private void SQLiteInit() { _connection = new Mono.Data.SqliteClient.SqliteConnection(_sqlDBLocation); _command = _connection.CreateCommand(); _connection.Open(); _connection.Close(); } } 

I don't know what's going wrong but Android doesn't like me xc

Submitted July 16, 2017 at 11:57AM by Voylinslife
via reddit http://ift.tt/2v6CQNn

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s