Errors Date Field
void Page1OnBeforePrint(TfrxComponent Sender)
{
CariKartDs.Close();
CariKartDs.SQL.Clear();
CariKartDs.SQL.Add("Select CariKod,KISAD,Mut_Date,Bakiye_Sekil,Risk_Kriteri From CariKart.db");
CariKartDs.SQL.Add("where Mut_Date>=:DateEdit1 and Mut_Date<=:DateEdit2");
CariKartDs.ParamByName("DateEdit1").Value=StrToDate("01.01.2005");
CariKartDs.ParamByName("DateEdit2").Value=StrToDate("31.12.2005");
CariKartDs.Open();
}
The following errors(s) occured:Type mismatch in expression.
How can I write "CariKartDs.ParamByName("DateEdit1").Value=StrToDate("01.01.2005");"
{
CariKartDs.Close();
CariKartDs.SQL.Clear();
CariKartDs.SQL.Add("Select CariKod,KISAD,Mut_Date,Bakiye_Sekil,Risk_Kriteri From CariKart.db");
CariKartDs.SQL.Add("where Mut_Date>=:DateEdit1 and Mut_Date<=:DateEdit2");
CariKartDs.ParamByName("DateEdit1").Value=StrToDate("01.01.2005");
CariKartDs.ParamByName("DateEdit2").Value=StrToDate("31.12.2005");
CariKartDs.Open();
}
The following errors(s) occured:Type mismatch in expression.
How can I write "CariKartDs.ParamByName("DateEdit1").Value=StrToDate("01.01.2005");"
Comments
1 a frxdateedit control has the property date which takes a date
unless you are modifying the whole query to select other fields
use startdate enddate for example as params
in the query's params property editor set the type and value for each parameter
ie startdate would be date and value would be dateedit1.date.
then you only have to modify datedit values instead of the whole query.
NOTE that when working with an object's value property, value returns a variant,
so you need to use vartostr() function to work with it.
mismatch errors usually mean that you have supplied a value of the wrong type
to what you are trying to supply to the objects property.