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.Fill(ds);
my_adapter.UpdateCommand = bld.GetUpdateCommand(true);
string text = my_adapter.UpdateCommand.CommandText;
} catch (Exception exc) {
string t = exc.Message;
}
The Code throws at GetUpdateCommand.
The same Code works on Windows.
Can anyone help me here please.