Hello to anyone reading this post.  I am having a problem with retrieving
data from cache passing a date parameter over ODBC.

I have included as much information as possible to aid anyone who may be
able to help me with this problem.

My code from .NET looks like so :



                  OdbcConnection myConnection = new
OdbcConnection("DSN=AC");

                  OdbcCommand myCommand = myConnection.CreateCommand();



                  myCommand.CommandText = "SELECT * FROM AC.Clinic WHERE DOS
= @Date";

                  OdbcParameter prm;

                  try

                  {



                        prm =
myCommand.Parameters.Add("Date",OdbcType.DateTime);

                        prm.Value = Convert.ToDateTime(txtINR.Text);

                  }

                  catch (Exception ex)

                  {

                        Trace.Write(ex.Message);

                  }

                  myConnection.Open();

                  OdbcDataReader myReader;



                  myReader = myCommand.ExecuteReader();



                  DataGrid2.DataSource=myReader;

                  DataGrid2.DataBind();



                  myReader.Close();



            myConnection.Close();



Nothing special about the query really.



Also the class looks like as follows :



Class AC.Clinic Extends %Persistent [ ClassType = persistent,
ProcedureBlock, StorageStrategy = MasterClinicMap ]

{



/// Date of Sample

Property DOS As %Date [ Required ];



/// Patient Lab number

Property PIDX As %String [ Required ];



Index Clinic On (DOS, PIDX) [ IdKey, Unique ];



}







The following works fine from Microsoft Access :



SELECT AC_Clinic.ID, AC_Clinic.DOS, AC_Clinic.PIDX

FROM AC_Clinic

WHERE (((AC_Clinic.DOS)=#4/28/2004#));



I have tried running this query as the .CommandText also with error.



My Runtime error looks like the following



Server Error in '/Anticoag' Application.

----------------------------------------------------------------------------
----

ERROR [42000] [Cach� ODBC][State : 37000][Native Code 12]
[C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe] [SQLCODE:
<-12>:<A term expected, beginning with one of the following: identifier,
constant, aggregate, $$, :, (, +, -, %ALPHAUP, %EXACT, %SQLSTRING,
%SQLUPPER, %STRING, or %UPPER>] [Cache Error: <<SYNTAX>errdone+1^%qaqqt>]
[Details: <FLoop - func = DQ>] [%msg: < SQL ERROR #12: A term expected,
beginning with either of: identifier, constant, aggregate, $$, (, :, +, -,
%ALPHAUP, %EXACT, %SQLSTRING,
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.Odbc.OdbcException: ERROR [42000] [Cach�
ODBC][State : 37000][Native Code 12]
[C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe] [SQLCODE:
<-12>:<A term expected, beginning with one of the following: identifier,
constant, aggregate, $$, :, (, +, -, %ALPHAUP, %EXACT, %SQLSTRING,
%SQLUPPER, %STRING, or %UPPER>] [Cache Error: <<SYNTAX>errdone+1^%qaqqt>]
[Details: <FLoop - func = DQ>] [%msg: < SQL ERROR #12: A term expected,
beginning with either of: identifier, constant, aggregate, $$, (, :, +, -,
%ALPHAUP, %EXACT, %SQLSTRING,

Source Error:

 Line 80:                           OdbcDataReader myReader;Line 81:
Line 82:                           myReader = myCommand.ExecuteReader();Line
83: Line 84:                           DataGrid2.DataSource=myReader;



Many thanks for your time

Kind Regards

Tony



Reply via email to