I need to grab the date value to validate with an ibquery, the next code I try to use to get the value, but without success
dm_dados.sqlConVenta.ParamByName('datavend').value :=DateTimePicker1.DateTime ;
I need to grab the date value to validate with an ibquery, the next code I try to use to get the value, but without success
dm_dados.sqlConVenta.ParamByName('datavend').value :=DateTimePicker1.DateTime ;
In this way, solve
dm_dados.sqlConVenta.ParamByName('datavend').Text :=DateToStr (DateTimePicker1.Date);
A better way in Delphi to assign dates (and any other data type value) is to use the type of data you are using explicitly, in this case:
dm_dados.sqlConVenta.ParamByName('datavend').AsDate := DateTimePicker1.Date;
And you define the data type of the datavend parameter as Date in the properties of the sqlConVenta object.
In the way you solved it, converting it to text and then converting it to date, there may be an error when passing the data by in configuration of how it is interpreted for example '2018-08-07' it may be interpreted by windows configuration as day 7 of the month of August in a computer and as day 8 of the month of June in another, in either case the value is correct, but when the day is over 12 you may have problems and dozens if not hundreds of records with incorrect dates and an error that did not happen and that now you have to correct.