I am working on a PAT for school can you please help me with my code keep getting the same error.
我正在为学校的PAT工作,请你帮我解决我的代码不断得到同样的错误。
This is my first one
这是我的第一个
DMrecord.qryMembers.Paramcheck := true;
DMrecord.qryMembers.SQL.Text := 'INSERT INTO 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 is my second one
这是我的第二个
DMrecord.qryResults.Paramcheck := true;
DMrecord.qryResults.SQL.Text := 'INSERT INTO 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 this makes it easier and thanks for the help
我希望这会让它变得更容易,并感谢你的帮助
1 个解决方案
#1
4
In your second query, you use
在您的第二个查询中,您使用
'INSERT INTO Member Result '
This will cause an error, as the table name contains a space and isn't being escaped. You need to wrap it in brackets:
这将导致错误,因为表名包含空格并且未被转义。你需要把它包在括号中:
'INSERT INTO [Member Result] '
#1
4
In your second query, you use
在您的第二个查询中,您使用
'INSERT INTO Member Result '
This will cause an error, as the table name contains a space and isn't being escaped. You need to wrap it in brackets:
这将导致错误,因为表名包含空格并且未被转义。你需要把它包在括号中:
'INSERT INTO [Member Result] '