SQLite error no such table, when using it with DBLinq in C#

829 Views Asked by At

I have created a database using the SQLite administrator. It contains 3 tables and the database is in the document folder. Also I have created the mapping class for Linq using DBMetal.

In application below is the code for the database connection and inserting new data to SongMasterLocal.

        static SQLiteConnection con = new SQLiteConnection(@"data source=C:\\Users\\Kam\\SongDb.s3db");

        SongDBML.SongDBMLDataContext dCon=null;

                      try
                      {

                         dCon = new SongDBML.SongDBMLDataContext(con);
                         SongDBML.SongMasterLocal tempSongMaster = new SongDBML.SongMasterLocal();
                          tempSongMaster.SongFilePath = this.FilePath;
                          tempSongMaster.Cleaned = true;
                         dCon.Connection.Open();
                         dCon.Connection.BeginTransaction();

                         dCon.GetTable<SongMasterLocal>().InsertOnSubmit(tempSongMaster);

                      //dCon.SongMasterLocal.InsertOnSubmit(tempSongMaster);
                      dCon.GetTable<NewTags>().InsertOnSubmit(tempNewTags);
                      dCon.SubmitChanges();
return true;


              }

              catch (Exception e)
              {
                  dCon.Connection.Close();
                  //throw e;
              }

When I execute the code I get SQLite error: no such table exist SongMasterLocal

If I try to create a new table using the SQLite execute command it will throw 'Table already exist error.'

Can anyone please help me resolve the problem.

And if you need more code or debug trace please ask and I will post them.

1

There are 1 best solutions below

0
On BEST ANSWER

Fixed the problem. The problem was in the mapping class (DBML file) created by the DBMetal which has table names as with the full namespace which was not recognized by the SQLite.It works like a charm now. –