Your current code is trying to convert C1DateEdit
control to a formatted string which is not valid operation. I guess you want to convert DateTime
value from that control instead :
command.Parameters.Add("_trdate", Format(dteDate.Value, "yyyy-MM-dd"))
assuming that dteDate.Value
is a correct way to get DateTime
value from C1DateEdit
, since I've never used ComponentOne control in my life. Anyway, if _trdate
parameter expect a DateTime
type in postgres, you can just pass a DateTime
object as parameter value. No need to take care of formatting, it will be handled automatically. Something like this (same assumption applied) :
command.Parameters.Add("_trdate", dteDate.Value)
Hope this shed some lights to your problem.