Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem.Data.SQLite issue with "IN" clause in query
    primarykey
    data
    text
    <p>I am working on compact framework and using ADO for sqlite. My sqlite database consist of 3 million records. The table structure is same as explain in <a href="https://stackoverflow.com/questions/14119713/system-data-sqlite-issue-on-compact-framework-3-5">THIS QUESTION</a>. I am trying to use a Data Adapter and Data Set to solve the issue mentioned in same question. However the new issue am facing is, whenever my query contains "IN" clause the data adapter's Fill(...) call does not return. Below is the query and logic I am using for filling data set.</p> <pre><code>string query = SELECT TimeStamp,Col2,Col3,Col4,Col5,Col6 FROM T1 WHERE (TimeStamp BETWEEN @startDate AND @endDate) AND Col5 IN {0} ORDER BY TimeStamp DESC LIMIT 0,@dataToRead </code></pre> <p><strong>Please note 'place holder' after IN clause</strong>. I required because my IN clause list will be created dynamically.</p> <p>I am using the sqlite command and data adapter as follows</p> <pre><code>using (SQLiteCommand cmd = _conn.CreateCommand()) { cmd.Parameters.AddWithValue("@startDate", startDate.Ticks); cmd.Parameters.AddWithValue("@endDate", endDate.Ticks); cmd.Parameters.AddWithValue("@dataToRead", dataToRead); //100 StringBuilder inParams = new StringBuilder(); if (true == webRequest &amp;&amp; webRequestFilter != WebCategory.All) { switch (webRequestFilter) { case WebCategory.One: { inParams.AppendFormat("({0})", (int)SystemCategory.One); break; } case WebCategory.Two: { inParams.AppendFormat("({0},{1},{2})", (int)SystemCategory.Two, (int)SystemCategory.Three, (int)SystemCategory.Four); break; } case WebCategory.Three: { inParams.AppendFormat("({0})", (int)SystemCategory.Five); break; } case WebCategory.Four: { inParams.AppendFormat("({0},{1},{2})", (int)SystemCategory.Six, (int)SystemCategory.Two, (int)SystemCategory.Three); break; } }// End Switch query = string.Format(query, inParams.ToString()); //Append place holder for IN clause }// End If cmd.CommandText = query; DataSet ds = new DataSet(); SQLiteDataAdapter da = new SQLiteDataAdapter(cmd); da.Fill(ds); // This call does not return. } </code></pre> <p>The query works well with Sqlite Shell and same database.</p> <p>Has anyone faced the similar issue with compact framework? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload