feliperochadev / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Error in AccessErrorLog query (SELECT) expression #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Copy Elmah.dll to a web application's bin directory.
2. Enter web.config entries to enable AccessErrorLog.
3. Copy the empty ELMAH.mdb file to App_Data directory.
4. Access the error log page http://localhost/elmah.axd.

What is the expected output? What do you see instead?

The expected output is the error log page with no error entries shown 
since the database is empty. Instead, the following OleDbException results 
(see attached file for more details):

System.Data.OleDb.OleDbException: Syntax error (missing operator) in query 
expression 'Application = @ApplicationORDER BY TimeUtc DESC, 
SequenceNumber DESC'.

[OleDbException (0x80040e14): Syntax error (missing operator) in query 
expression 'Application = @ApplicationORDER BY TimeUtc DESC, 
SequenceNumber DESC'.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult
(tagDBPARAMS dbParams, Object& executeResult) +267
   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& 
executeResult) +192
   System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, 
Object& executeResult) +48
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior 
behavior, String method) +106
   System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) 
+111
   System.Data.OleDb.OleDbCommand.ExecuteReader() +6
   Elmah.AccessErrorLog.GetErrors(Int32 pageIndex, Int32 pageSize, IList 
errorEntryList) in c:\Projects\Public\ELMAH\src\Elmah\AccessErrorLog.cs:255
   Elmah.ErrorLogPage.OnLoad(EventArgs e) in 
c:\Projects\Public\ELMAH\src\Elmah\ErrorLogPage.cs:80
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean 
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

At other times, the error message read, "The SELECT statement includes a 
reserved word or an argument name that is misspelled or missing, or the 
punctuation is incorrect."

Environment:

- ELMAH version: revision 284 of the source repository
- OS: Windows Vista Business Edition SP 1 (Build 6001)
- ASP.NET: version 3.5

Original issue reported on code.google.com by azizatif on 8 May 2008 at 8:33

Attachments:

GoogleCodeExporter commented 9 years ago
I think the problem may be here in AccessErrorLog.cs:

247:                sql.Append("WHERE Application = @Application");
248:                sql.Append("ORDER BY TimeUtc DESC, SequenceNumber DESC) ");

There is a trailing space missing in "WHERE Application = @Application".

Original comment by azizatif on 8 May 2008 at 8:35

GoogleCodeExporter commented 9 years ago
Attached the details of the other error message seen, along the lines of, "The 
SELECT statement includes a reserved word or an argument name that is 
misspelled or 
missing, or the punctuation is incorrect."

Odd that two different errors were seen to what seems to be a single root cause.

Original comment by azizatif on 8 May 2008 at 8:40

Attachments:

GoogleCodeExporter commented 9 years ago
Resolved in revision 286

Original comment by jamesdriscoll71 on 8 May 2008 at 8:48