with Query1 Do
begin
Close;
SQL.Clear;
SQL.ADD('Delete from MATSHM');
if rbndelete.checked then
begin
SQL.ADD(' where SHMDAT = ' + mskolddat.text + '');
SQL.ADD(' and SHMCONNO = ''' + cbxOld_CONNO.text + '''');
if txtspl.text <> '' then sql.add(' and shmspl = ''' + txtspl.text + ''' ');
end;
if rbnUpdate.checked then
sql.add(' where shmspl = ''' + txtspl.text + ''' ');
if mskodno.text <> '' then sql.add(' and shmodno = ''' + mskodno.text + ''' ');
ExecSQL; ---> 여기서 에러가 납니다.
Close;
end;
위와같은 문장을 실행하는데 and 구문근처에서 에러가 났다고 메세지가 뜹니다. and 근처구문을 어떻게 바꿔야 하는지요...좀 알려주세요..부탁드려요.
그것땜에 에러도 잦고 헷갈리기도 하죠?
그래서 제가 자주 쓰는 팁을 적을께요.
var
QUOTE: String = '"';
이렇게 선언해 두구요..
문장 작성할때에 ''' 대신 QUOTE를 씁니다.
헷갈리지 않겠죠?
이하은 wrote:
> with Query1 Do
> begin
> Close;
> SQL.Clear;
> SQL.ADD('Delete from MATSHM');
> if rbndelete.checked then
> begin
> SQL.ADD(' where SHMDAT = ' + mskolddat.text + '');
> SQL.ADD(' and SHMCONNO = ''' + cbxOld_CONNO.text + '''');
> if txtspl.text <> '' then sql.add(' and shmspl = ''' + txtspl.text + ''' ');
> end;
> if rbnUpdate.checked then
> sql.add(' where shmspl = ''' + txtspl.text + ''' ');
> if mskodno.text <> '' then sql.add(' and shmodno = ''' + mskodno.text + ''' ');
> ExecSQL; ---> 여기서 에러가 납니다.
> Close;
> end;
>
> 위와같은 문장을 실행하는데 and 구문근처에서 에러가 났다고 메세지가 뜹니다. and 근처구문을 어떻게 바꿔야 하는지요...좀 알려주세요..부탁드려요.