Avatar of firekiller15
firekiller15

asked on 

I try to join two table together but received error message

delphi

I have two table STUDENTTABLE and STUDENTPROFILE
In STUDENTTABLE I HAVE 2 field which are STUDENTID and STUDENTNAME
In STUDENTPROFILE I HAVE 2 field as well which are STUDENTID and STUDENTCONTACT    

I want to find studentcontact of particular student (Find by knowing student name)
Therefore i join two table together and i recieved following error

SQL command not properly ended
how to solve
below is my code


SQL.Clear;
      SQL.Add('SELECT STUDENTID,STUDENTCONTACT FROM STUDENTTABLE ST JOIN STUDENTPROFILE SP ON ST.STUDENTID = SP.STUDENTID');
      SQL.Add('WHERE STUDENTNAME = :studentname);
            
      ParambyName('studentname').AsString := studentname.text;
      Open;
 
      try
        if (not EOF) then
        begin
          studentID.text:= inttostr(FieldByName('STUDENTID').AsInteger);
          studentContact.text := FieldByName('STUDENTCONTACT').ASSTRING;
 
        end;

Open in new window

Editors IDEsDelphi

Avatar of undefined
Last Comment
Geert G

8/22/2022 - Mon