sql - Syntax error in “insert into statement” -


i working on pat school can please me code keep getting same error.

this first one

dmrecord.qrymembers.paramcheck := true; dmrecord.qrymembers.sql.text := 'insert members '             +'([membername],[membersurname],[age],[cellnumber],[emailaddress])'             +' values '             +'(:membername, :membersurname, :age, :cellnumber,:emailaddress)';              dmrecord.qrymembers.parameters.parambyname('membername').value := sname;              dmrecord.qrymembers.parameters.parambyname('membersurname').value := ssurname;              dmrecord.qrymembers.parameters.parambyname('age').value := iage;              dmrecord.qrymembers.parameters.parambyname('cellnumber').value := icellphone;              dmrecord.qrymembers.parameters.parambyname('emailaddress').value := semail;              dmrecord.qrymembers.execsql; 

this second one

dmrecord.qryresults.paramcheck := true; dmrecord.qryresults.sql.text := 'insert member result '             +'([clubnumber],[event],[averagetime/distance],[numberofcompetition],[agegroup])'             +' values '             +'(:clubnumber, :event, :averagetimedistance, :numberofcompetition, :agegroup)';             dmrecord.qryresults.parameters.parambyname('clubnumber').value := iclubnumber;             dmrecord.qryresults.parameters.parambyname('event').value := sevent;             dmrecord.qryresults.parameters.parambyname('averagetimedistance').value := ravg;             dmrecord.qryresults.parameters.parambyname('numberofcompetition').value := inumcomps;             dmrecord.qryresults.parameters.parambyname('agegroup').value := sagegroup;             dmrecord.qryresults.execsql; 

i hope makes easier , help

in second query, use

'insert member result ' 

this cause error, table name contains space , isn't being escaped. need wrap in brackets:

'insert [member result] ' 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -