Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by imramh · May 08, 2016 at 03:15 PM · sqlite

sqLite table not found

I use this code but There error SqliteException: SQLite error no such table: sqlite_stat1 where is problem?

 using UnityEngine;
 using System.Collections;
 using System.Data;
 using Mono.Data.Sqlite;
 
 public class PlayerDataManger : MonoBehaviour {
 
 
     private string connectionString;
 
     // Use this for initialization
     void Start () {
         connectionString = "URI=file:" + Application.dataPath + "/existing.sqlite";
     
         GetConnectionScore ();
     }
     
 
     void GetConnectionScore ()
     {
         using (IDbConnection dbConnection = new SqliteConnection (connectionString)) {
             dbConnection.Open ();
 
             using (IDbCommand dbCmd = dbConnection.CreateCommand ()) {
 
                 //string sqlQuery = "Select * From Person";
                 string sqlQuery = "Select idx from sqlite_stat1";
 
                 dbCmd.CommandText = sqlQuery;
 
                 using (IDataReader reader = dbCmd.ExecuteReader ()) {
                 
                     while (reader.Read ()) {
                     
                     //    Debug.Log (reader.GetString (0));
                         Debug.Log (5);
                     
                     }
                 
                 
                     dbConnection.Close ();
                     reader.Close ();
                 
                 }
             }
         
         }
 
 
 
     }
 }


alt text

DB alt text

db.png (48.1 kB)
untitled.png (84.1 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by imramh · Aug 02, 2016 at 09:56 PM

problem solved the proble in extention database name Database must be existing.db

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by jgodfrey · May 08, 2016 at 03:28 PM

The db you show in your screen shots is called "existing.db". The db you access in your code is called "existing.sqlite". I can only assume that the "existing.sqlite" db doesn't contain a table named "sqlite_stat1".

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image imramh · May 08, 2016 at 05:17 PM 0
Share

when change name to "existing.db". appear problem InvalidCastException: Cannot cast from source type to destination type.$$anonymous$$ono.Data.Sqlite.SqliteDataReader.VerifyType (Int32 i, DbType typ)

table named "sqlite_stat1". exist you can see now alt text

avatar image jgodfrey imramh · May 08, 2016 at 05:51 PM 0
Share

That's a completely different problem. Since you're now getting a cast error from the DataReader, you've successfully accessed your db and the table in question. So, you're original problem is solved it seems...

Regarding the new problem... In the code you posted, I don't see where you're ever attempting to cast anything you've read with the DataReader. Is your code different now?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

55 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sqlite memory leak causing game to crash 0 Answers

Moving a file from the project folder to the data directory at runtime 1 Answer

Data Source cannot be empty. Use :memory: to open an in-memory database Could not find a part of the path 0 Answers

How do you Sort List by field? 1 Answer

Unity5 Android Exporting - Different behaviours on different devices 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges