Q&A

  • 꼭좀 도와주세요
IF RADIOGROUP1.ITEMINDEX = 4 THEN

BEGIN

with FORM1.QUERY1 do

begin

Active := False;

SQL.Clear();

SQL.Add(' SELECT DBPGM.PGMID,DBPGM.PGMTITLE ');

SQL.Add(' FROM DBPGM, DBSUB ');

SQL.Add(' WHERE DBPGM.PGMID = :DBPGM.PGMID ');

SQL.Add(' AND WHERE DBSUB.PGMID = :DBSUB.PGMID ');

PARAMByName('SUBPGM1').AsString := Edit1.Text; OR

PARAMByName('SUBPGM2').AsString := Edit1.Text; OR

PARAMByName('SUBPGM3').AsString := Edit1.Text; OR

PARAMByName('SUBPGM4').AsString := Edit1.Text; OR

PARAMByName('SUBPGM5').AsString := Edit1.Text;



Active := True;



(*

FORM1.QUERY1.CLOSE;

FORM1.QUERY1.SQL.CLEAR;



SSQL := FORMAT('SELECT DBPGM.PGMID, DBPGM.PGMTITLE FROM DBPGM, DBSUB WHERE DBPGM.PGMID = DBSUB.PGMID AND DBSUB.SUBPGM1 =''%S''', [TRIM(EDIT1.TEXT)]) OR

FORMAT('SELECT DBPGM.PGMID, DBPGM.PGMTITLE FROM DBPGM, DBSUB WHERE DBPGM.PGMID = DBSUB.PGMID AND DBSUB.SUBPGM2 =''%S''', [TRIM(EDIT1.TEXT)]) OR

FORMAT('SELECT DBPGM.PGMID, DBPGM.PGMTITLE FROM DBPGM, DBSUB WHERE DBPGM.PGMID = DBSUB.PGMID AND DBSUB.SUBPGM3 =''%S''', [TRIM(EDIT1.TEXT)]) OR

FORMAT('SELECT DBPGM.PGMID, DBPGM.PGMTITLE FROM DBPGM, DBSUB WHERE DBPGM.PGMID = DBSUB.PGMID AND DBSUB.SUBPGM4 =''%S''', [TRIM(EDIT1.TEXT)]) OR

FORMAT('SELECT DBPGM.PGMID, DBPGM.PGMTITLE FROM DBPGM, DBSUB WHERE DBPGM.PGMID = DBSUB.PGMID AND DBSUB.SUBPGM5 =''%S''', [TRIM(EDIT1.TEXT)]);



FORM1.QUERY1.SQL.ADD(SSQL);

*)



TRY



FORM1.QUERY1.OPEN;

SHOWMESSAGE(SSQL);

form1.select first();



STRINGGRID1.Cells[0,0] := '프로그램아이디';

STRINGGRID1.Cells[1,0] := '프로그램제목';

STRINGGRID1.CELLS[0,1]:=FORM1.QUERY2.FIELDS[0].ASSTRING;

STRINGGRID1.CELLS[1,1]:=FORM1.QUERY2.FIELDS[1].ASSTRING;

FORM1.QUERY2.SQL.CLEAR;



EXCEPT

FORM1.QUERY1.CLOSE;



APPLICATION.MESSAGEBOX('검색도중 에러발생', '에러', MB_OK+MB_ICONINFORMATION);

EXIT;



//Query1.FREE;



end;



FORM1.QUERY1.CLOSE;



END;



이 코딩이 잘못되었나여?

0  COMMENTS