SQLiteCommandBuilder returns error No Table Informat

Hello, can you please help me.
I have created a table and now I want to generate the Update command with SQLiteCommandBuilder.
But the Commandbuilder fails with
Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.

Im at a loss here, The Table has a primary key, and the Fill is working, giving me a Table with the 2 Fields. Its just the Commandbuilder thats failing me.

` string extStorage = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;

  string ProjectPath = Path.Combine(extStorage, "DBTEST");
  string dbFile = Path.Combine(ProjectPath, "TEST.DB");
  if (!Directory.Exists(ProjectPath)) {
    Directory.CreateDirectory(ProjectPath);
  }

  if (File.Exists(dbFile)) {
    File.Delete(dbFile);
  }
  SqliteConnection.CreateFile(dbFile);


  string my_Connection = string.Format("Data Source={0};Version=3;", dbFile);
  try {
    SqliteConnection my_DB_Con = new SqliteConnection(my_Connection);
    my_DB_Con.Open();
    SqliteCommand cmdCreate = new SqliteCommand("Create Table [T_RESULT] ( [LFDNR] int PRIMARY KEY not null, [TTT1] text);", my_DB_Con);
    cmdCreate.ExecuteNonQuery();

    SqliteCommand cmd = new SqliteCommand("select * from [T_RESULT]", my_DB_Con);
    SqliteDataAdapter my_adapter = new SqliteDataAdapter(cmd);
    DataSet ds = new DataSet();
    my_adapter.Fill(ds, "T_RESULT");



    SqliteCommandBuilder bld = new SqliteCommandBuilder(my_adapter);
    my_adapter.UpdateCommand = bld.GetUpdateCommand();

  } catch (Exception exc) {
    string t = exc.Message;
  }

`

Answers

  • SvenWittnerSvenWittner DEMember ✭✭

    As an Update, the same Code works in a Windows Form Application.

    I copied the DB File to the device and comented out the creation of the db and the table. It still didnt work.
    So something seems to work wrong with the SqliteDataAdapter or the SqliteCommandbuilder

    Is there anything I can do to get this working on Android?

Sign In or Register to comment.