Topic: Help with SQLExecute conversions
Hello folks,
.
I felt like this is a silly elementary question, but I cannot figure out how to convert the types that a SQLExecute returns. It obviously works as a string, but for anything else:
var dateHire : date;
dateHire := strToDate(SQLExecute('SELECT dateHire FROM employee where ID = ' + frmEmpRecord.tbEmpID.Text));
or
dateHire := strToDateTime(SQLExecute('SELECT dateHire FROM employee where ID = ' + frmEmpRecord.tbEmpID.Text));
.
I get "not a valid date and time"
.
and
.
dateHire := SQLExecute('SELECT dateHire FROM employee where ID = ' + frmEmpRecord.tbEmpID.Text);
.
I get "could not convert variant of type (UnicodeString) into type (Double)"
.
so then I try:
.
var dateHire : double;
dateHire := StrToFloat(SQLExecute('SELECT dateHire FROM employee where ID = ' + frmEmpRecord.tbEmpID.Text));
.
I get "not a valid floating point value"
.
so then I try removing the StrToFloat and get the (Unicode String) error again...
.
I sifted through several pages of forum posts for related examples. I'm not sure what else to try. Would someone be kind enough to help me out here? I have had this issue in the past, but I usually found another way around it. But I wanted to reach out and find the proper way of doing this for future use...