How to create a command passing parameters
Posted: Thu 26 Oct 2017 12:30
I would like to use TMSQuery to create a parametric command.
I usually do
MSQuery1.SQL.Text := 'CREATE DATABASE ' + aMyDBName;
but if I have
CREATE DATABASE :MyDBName
and i try to do
MSQuery1.ParamByName('MyDBName').asstring := aMyDBName;
when i execute the query i have
"Wrong syntax near @P1"
how to avoid this error and use ParamByName succesfully in my context?
Thanks
I usually do
MSQuery1.SQL.Text := 'CREATE DATABASE ' + aMyDBName;
but if I have
CREATE DATABASE :MyDBName
and i try to do
MSQuery1.ParamByName('MyDBName').asstring := aMyDBName;
when i execute the query i have
"Wrong syntax near @P1"
how to avoid this error and use ParamByName succesfully in my context?
Thanks