Bad news X| I tried use the suggested method and the result of the test in a device (HTC Touch2) is a desaster! The device spend much time running SQLs when I use "like" (about 1~2 seconds). If the user type 100 characters, the total time of the operations is about 100~200 seconds. (not a good result) I did more tests in the device, and the results are worst. Look:
SQLiteConnection cnn = openCon();
string SQL = "select cod, desc from produtcs";
SQLiteDataReader sDR;
List<MyObj> data = new List<MyObj>();
cnn.Open();
// execution time: 1 second (emulator)
// execution time: 1~2 second (device)
SQLiteCommand sCommand = new SQLiteCommand(SQL, cnn);
sDR = sCommand.ExecuteReader();
// execution time: 5~6 seconds (emulator)
// execution time: 18~20 seconds (device)
// alternative test: 1 seconds (emulator)
// alternative test: 6 seconds (device)
while (sDR.Read())
{
data.Add(new MyObj(Convert.ToInt32(sDR["cod"].ToString()), sDR["desc"].ToString()));
// Alternative test inserting null objects
// data.Add(new MyObj());
}
// execution time: 6 seconds (emulator)
// execution time: 18 seconds (device)
// same times with alternative data
listBox1.DataSource = data;
// with GRID VIEW
// execution time: 0 seconds (emulator)
// execution time: 0 seconds (device)
dataGrid1.DataSource = data;
Now I'll try make it without use a List<> and insert direclty in a listBox. At the moment the best solution. I post my feedback later.
[]'s Eder Sá