Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in Expression

Status
Not open for further replies.

JimReiley

MIS
Dec 10, 2004
58
US
The following code gives me :
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface][Error in expression: :BilledDate

procedure UpDateFJDataBase(AdNumber:string;BilledDate:tDateTime);
var
EntryYear : string;
begin
if (AdNumber[2]='C') then
EntryYear := '2005' else
EntryYear := '2005';

FJMain.Query2.Close;
FJMain.Query2.SQL.Clear;
FJMain.Query2.SQL.Add('Update FreshJobs A');
FJMain.Query2.SQL.Add('set A.FJInvoiceDate = :BilledDate');
FJMain.Query2.SQL.Add('where A.AdNumber = :AdNumber');
FJMain.Query2.SQL.Add(' and A.EntryYear = :EntryYear');

FJMain.Query2.Params[0].asDate := BilledDate;
FJMain.Query2.Params[1].asString := AdNumber;
FJMain.Query2.Params[2].asString := EntryYear;

FJQuery := FJMain.Query2.Text;
FJMain.Query2.ExecSQL;
end;
 
You might try:
FJMain.Query2.SQL.Add('set A.FJInvoiceDate = ?');
FJMain.Query2.SQL.Add('where A.AdNumber = ?');
FJMain.Query2.SQL.Add(' and A.EntryYear = ?');
Pervasive uses "?" as parameter markers.



Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
Again you provide correct answers. Thanks very much, it worked. Where do you find documentation of these things?
 
I'm not really sure where it's in the Docs but I've been programming with ODBC and Pervasive (and Btrieve) for a number of years and it's just something I've picked up. It's the same concept as using SQLBindParameter ODBC API calls.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
Thanks again. I've used the btrieve side of Pervasive since it was called Softcraft. SQL is relatively new to me. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top