Server Error in '/' Application.

Incorrect syntax near the keyword 'and'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Incorrect syntax near the keyword 'and'.

Source Error:


Line 47:             strSQL = "select * from DirectorOptions where Region=" & ViewState("Region") & " and (LowDivision=" & thisdiv & " and HighDivision=" & thisdiv & ")"
Line 48:             cmdLogin = New OleDbCommand(strsql, conLogin)
Line 49:             rdrLogin = cmdLogin.ExecuteReader
Line 50:             If rdrLogin.HasRows Then
Line 51:                 If rdrLogin.Read Then

Source File: G:\PleskVhosts\thspa.us\httpdocs\regionalrecords.aspx    Line: 49

Stack Trace:


[OleDbException (0x80040e14): Incorrect syntax near the keyword 'and'.]
   System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr) +1033278
   System.Data.OleDb.OleDbDataReader.NextResult() +421
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +235
   System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116
   System.Data.OleDb.OleDbCommand.ExecuteReader() +6
   ASP.regionalrecords_aspx.RefreshRecords() in G:\PleskVhosts\thspa.us\httpdocs\regionalrecords.aspx:49
   ASP.regionalrecords_aspx.Page_Load(Object sender, EventArgs e) in G:\PleskVhosts\thspa.us\httpdocs\regionalrecords.aspx:32
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


Version Information: Microsoft .NET Framework Version:2.0.50727.9061; ASP.NET Version:2.0.50727.9062