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 /
avatar image
0
Question by Witt3D · Sep 01, 2017 at 08:23 AM · databaselocal

NSqlite problem findwhere or read value from database

Hi, i tried to get in touch with the creator of NSqlite several times and with different emails, but get no answer.

So i decide to put down my problem here. Im working with a local database with the plugin NQslite. I can create it and insert values, but i get always the same error when trying to read or compare o find somethinf with parameters.ççmy code is really simple.

Just linked some databses to others.

void Start() {

     const string databaseName = "QSF_BD.rdb";
     
     string dbPath = DataBasePath.DbPath(databaseName);

     string fecha = DateTime.Now.ToString("yyyy-MM-dd");

     int fecha_ano = int.Parse(DateTime.Now.Year.ToString());

     var Temporadas = new Temporada
     {
         Ano = fecha_ano,
         Equipo = "RCD ESPANYOL",
         Posicion_Liga = 3,
         Puntos = 57,
         Objetivo_1 = "OCTAVOS FINAL COPA DEL REY",
         Objetivo_2 = "",
         Objetivo_3 = "",
         Objetivo_4 = "",
         Creacion = DateTime.Now,
         Ult_Modificacion = DateTime.Now,
         Calendario = new List<Memoria>
         {
             new Memoria
             {
                 Fecha = fecha,
                 Momento = 0,
                 Tipologia = "Viaje",
                 Hora = 9,
                 Minuto = 30,
                 Creacion = DateTime.Now,
                 Ult_Modificacion = DateTime.Now,

                 Partidos = new List<Partido>
                 {
                     new Partido
                     {
                         Fecha_Partido = fecha,
                         Equipo_C = "RCD ESPANYOL",
                         Equipo_V = "SEVILLA C.F.",
                         Goles_C = 0,
                         Goles_V = 0,
                         Tipo_Partido = "AMISTOSO",
                         Creacion = DateTime.Now,
                         Ult_Modificacion = DateTime.Now,
                     },
                 },

                 Entrenamientos = new List<Entrenamineto>
                 {
                     new Entrenamineto
                     {
                         Fecha_Entrenamiento = fecha,
                         Sesion = 0,
                         Tarea = 0,
                         Editado = 0,
                         Tiempo = 0,
                         Ruta = "C:/Users/Cote/Desktop/QSF/Unity Projects/Sesion Entrenamiento/Assets/StreamingAssets/Memoria/ATAQUE POSICIONAL.jpg",
                         Ruta_Editado = "C:/Users/Cote/Desktop/QSF/Unity Projects/Sesion Entrenamiento/Assets/StreamingAssets/Memoria/001-02-08-sdf.jpg",
                         Jugadores = new List<string> { "Aaron", "Mario", "Royo", "Lopez" },
                         Objetivos = new List<string> { "Ataque", "Defensa", "Inico", "Finalizacion" },
                         Creacion = DateTime.Now,
                         Ult_Modificacion = DateTime.Now,
                     },
                 },
             },
         },
           
     };

     Repository<Temporada> repository = new Repository<Temporada>(dbPath);

     repository.Insert(Temporadas);

     List<Temporada> temporadasList = repository.FindWhere(b => b.Ano == 2017);

     Debug.Log(temporadasList.Count);
 }

 /// <summary>
 ///     Model classes MUST inherit from <see cref="Storable"/>. 
 /// </summary>
 public class Temporada : Storable
 {
     public int Ano { get; set; }

     public string Equipo { get; set; }

     public int Posicion_Liga { get; set; }

     public int Puntos { get; set; }

     public string Objetivo_1 { get; set; }

     public string Objetivo_2 { get; set; }

     public string Objetivo_3 { get; set; }

     public string Objetivo_4 { get; set; }

     public DateTime Creacion { get; set; }

     public DateTime Ult_Modificacion { get; set; }

     public List<Memoria> Calendario { get; set; }
 }

 /// <summary>
 ///     Model classes MUST inherit from <see cref="Storable"/>. 
 /// </summary>
 public class Memoria : Storable
 {
     public string Fecha { get; set; }

     public int Momento { get; set; }

     public string Tipologia { get; set; }

     public int Hora { get; set; }

     public int Minuto { get; set; }

     public DateTime Creacion { get; set; }

     public DateTime Ult_Modificacion { get; set; }

     public List<Partido> Partidos { get; set; }

     public List<Entrenamineto> Entrenamientos { get; set; }
 }

 /// <summary>
 ///     Model classes MUST inherit from <see cref="Storable"/>. 
 /// </summary>
 public class Entrenamineto : Storable
 {
     public string Fecha_Entrenamiento { get; set; }

     public int Sesion { get; set; }
     
     public int Tarea { get; set; }

     public int Editado { get; set; }

     public int Tiempo { get; set; }

     public string Ruta { get; set; }

     public string Ruta_Editado { get; set; }

     public List<string> Jugadores { get; set; }

     public List<string> Objetivos { get; set; }

     public DateTime Creacion { get; set; }

     public DateTime Ult_Modificacion { get; set; }
 }

 /// <summary>
 ///     Model classes MUST inherit from <see cref="Storable"/>. 
 /// </summary>
 public class Partido : Storable
 {
     public string Fecha_Partido { get; set; }

     public string Equipo_C { get; set; }

     public string Equipo_V { get; set; }

     public int Goles_C { get; set; }

     public int Goles_V { get; set; }

     public string Tipo_Partido { get; set; }

     public DateTime Creacion { get; set; }

     public DateTime Ult_Modificacion { get; set; }
 }

when i just try to check if a value is the same than other:

List temporadasList = repository.FindWhere(b => b.Ano == 2017);

I get always this error, no matter i change to int variables, to string, i try to prse to int, no way, im doing something wrong:

FormatException: Input string was not in the correct format System.Int32.Parse (System.String s) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Int32.cs:629) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].ConvertToProperObjectFormat (System.ComponentModel.PropertyDescriptor property, System.Object value) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].ReadDataFromReader[TemporadaCalendarioEntrenamientos] (Mono.Data.Sqlite.SqliteDataReader reader) NPlugins.Sqlite.Repository`1+FindData+<>c_DisplayClass13`1[QSF+Temporada,TemporadaCalendarioEntrenamientos].b12 (Mono.Data.Sqlite.SqliteDataReader reader) NPlugins.Sqlite.Repository`1[QSF+Temporada].RunQuery (System.String query, System.Action`1 read) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].FindList[TemporadaCalendarioEntrenamientos] (System.String query) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].FindWhereProperty[TemporadaCalendarioEntrenamientos] (System.String propertyName, System.Object value) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].ConvertArrayObjectToProperObjectFormat (System.ComponentModel.PropertyDescriptor property, Int32 index, System.Type tableType) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].ReadDataFromReader[TemporadaCalendario] (Mono.Data.Sqlite.SqliteDataReader reader) NPlugins.Sqlite.Repository`1+FindData+<>cDisplayClass13`1[QSF+Temporada,TemporadaCalendario].b12 (Mono.Data.Sqlite.SqliteDataReader reader) NPlugins.Sqlite.Repository`1[QSF+Temporada].RunQuery (System.String query, System.Action`1 read) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].FindList[TemporadaCalendario] (System.String query) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].FindWhereProperty[TemporadaCalendario] (System.String propertyName, System.Object value) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].ConvertArrayObjectToProperObjectFormat (System.ComponentModel.PropertyDescriptor property, Int32 index, System.Type tableType) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].ReadDataFromReader[Temporada] (Mono.Data.Sqlite.SqliteDataReader reader) NPlugins.Sqlite.Repository`1+FindData+<>cDisplayClass13`1[QSF+Temporada,QSF+Temporada].b_12 (Mono.Data.Sqlite.SqliteDataReader reader) NPlugins.Sqlite.Repository`1[QSF+Temporada].RunQuery (System.String query, System.Action`1 read) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].FindList[Temporada] (System.String query) NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].FindAll[Temporada] () NPlugins.Sqlite.Repository`1+FindData[QSF+Temporada].FindWhere[Temporada] (System.Func`2 expression) NPlugins.Sqlite.Repository`1[QSF+Temporada].FindWhere (System.Func`2 expression) QSF.Start () (at Assets/01 SCRITPS/00_BD/QSF.cs:86)

Thank you.

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

0 Replies

· Add your reply
  • Sort: 

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

70 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 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

how to access and modify my existing database made by DB browser for SQLite in unity after build 0 Answers

Cross platform local Database option for unity with Permissions 1 Answer

Local database method? 1 Answer

Accessing local system ( File Browser ) 2 Answers

SQLite and Unity 3 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