Q&A

  • 오라클에선 이게 안먹히나요??
델파이와 오라클을 연동하여 작업중입니다..



with query1 do

begin

close;

sql.clear;

sql.add('select count(사번) as number from master'); -->1

sql.add('where m_ymd = "20001212" '); -->2

execsql;

end;

label1.caption := query1.fieldbyname('number').asstring;



위와 같이 하면 안되네여....

첫번째.. as number에서 에러가 나고요...

두번째.. "20001212"에서 에러가 납니다....







3  COMMENTS
  • Profile
    권경미 2000.12.15 02:45
    델파이와 오라클을 연동하여 작업중입니다..



    with query1 do

    begin

    close;

    sql.clear;

    sql.add('select count(사번) as cnt from master '); -->1

    sql.add('where m_ymd = ''20001212'' '); -->2

    open;

    end;

    label1.caption := query1.fieldbyname('cnt').asstring;



    이렇게 해보세요.



    1 에서는 number가 Keyword인가봐요...



    2 에서는 문자열을 표현할때 "가 아니구 '로 표현하셔야 합니다.



    마지막에 execsql -> open

  • Profile
    이영민 2000.12.15 02:40
    김정규 wrote:

    > 델파이와 오라클을 연동하여 작업중입니다..

    >

    > with query1 do

    > begin

    > close;

    > sql.clear;

    > sql.add('select count(사번) as number from master'); -->1

    > sql.add('where m_ymd = "20001212" '); -->2

    > execsql;



    Select는 Open~~

    Insert, Update, Delete등의 DML문장은 ExecSQL을 사용하세요~~



    > end;

    > label1.caption := query1.fieldbyname('number').asstring;

    >

    > 위와 같이 하면 안되네여....

    > 첫번째.. as number에서 에러가 나고요...

    > 두번째.. "20001212"에서 에러가 납니다....

    >

    >

    >

  • Profile
    friggacho 2000.12.15 02:36
    김정규 wrote:

    > 델파이와 오라클을 연동하여 작업중입니다..

    >

    > with query1 do

    > begin

    > close;

    > sql.clear;

    > sql.add('select count(사번) as number from master'); -->1

    > sql.add('where m_ymd = "20001212" '); -->2

    > execsql;

    > end;

    > label1.caption := query1.fieldbyname('number').asstring;

    >

    > 위와 같이 하면 안되네여....

    > 첫번째.. as number에서 에러가 나고요...

    > 두번째.. "20001212"에서 에러가 납니다....

    >

    >

    >



    with query1 do

    begin

    close;

    sql.clear;



    ssql := 'select count(사번) as number from master' +

    ' where m_ymd = ''20001212'' ';

    (물론 ssql을 String으로 정의하고요)

    query1.sql.text := ssql;



    try

    open;

    except

    showmessage('DB에 오류발생')

    end;

    end;