Bug 17031 - Getting "no such function: TOP" error when trying to use function "FirstOrDefault" in linq..
Summary: Getting "no such function: TOP" error when trying to use function "FirstOrDef...
Status: RESOLVED ANSWERED
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Data.Sqlite ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-01-03 03:30 UTC by Aditya Barelia
Modified: 2018-03-13 16:20 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Aditya Barelia 2014-01-03 03:30:51 UTC
==InnerException: Mono.Data.Sqlite.SqliteException: SQLite error
no such function: TOP
  at Mono.Data.Sqlite.SQLite3.Prepare (Mono.Data.Sqlite.SqliteConnection cnn, System.String strSql, Mono.Data.Sqlite.SqliteStatement previous, UInt32 timeoutMS, System.String& strRemain) [0x00000] in <filename unknown>:0 
  at Mono.Data.Sqlite.SqliteCommand.BuildNextCommand () [0x00000] in <filename unknown>:0 , Stack: 
  at Mono.Data.Sqlite.SQLite3.Prepare (Mono.Data.Sqlite.SqliteConnection cnn, System.String strSql, Mono.Data.Sqlite.SqliteStatement previous, UInt32 timeoutMS, System.String& strRemain) [0x00000] in <filename unknown>:0 
  at Mono.Data.Sqlite.SqliteCommand.BuildNextCommand () [0x00000] in <filename unknown>:0 

Please help me figure out what this bug is.
Comment 1 Stefan K 2017-01-24 22:53:55 UTC
SQLite uses the command LIMIT instead of TOP

Use:

    SELECT * FROM Table_Name LIMIT 5;

Instead of:

    SELECT TOP(5) * FROM Table_Name;