C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[64977] Re:INSERT () RETURNING 값 보는 방법?
smleelms [smleelms] 974 읽음    2011-08-11 21:44
좀 어설프지만 이런식으로도 INSERT 가능하구요, ExecSQL의 리턴값은 실행된 쿼리문의 영향을 받는 열의 수라고 되어 있네요.

"ExecSQL returns the number of rows affected by the executed command. This becomes the value of the RowsAffected property."

SQLDataSet1은 SQLConnection과 연결되어 있습니다.
원하시는 답변이 되었으면 좋겠네요.

	AnsiString str = "";

	str  = "INSERT INTO TABLE1 VALUES (NEXT VALUE FOR IDX_SEQ, ";
	str += QuotedStr(MMSDatas.dt.FormatString("yyyy-mm-dd hh:nn:ss"));
	str += ", ";
	str += IntToStr(MMSDatas.byMode);
	str += ")";

	SQLDataSet1->CommandText = str;

	try
	{
		SQLDataSet1->ExecSQL(true);
	}
 	catch(const Exception& e)
	{
		OnShowMsgStatus(e.Message);
		SQLDataSet1->Cancel();
	}



수연 님이 쓰신 글 :
: 안녕하세요
: Firebird 2.5, DBExpress 4, C++ Builer 2007 쓰고 있는데...
:
: insert 후에 returning 으로 값을 받아 오는 예제가 delphi 로 된 건 찾았어요
:
:
: procedure TForm1.Button_testClick(Sender: TObject);
: var
:   dataResult: TCustomSQLDataSet;
: begin
:   dataResult := nil;
:   dm.SQLConnection_sdi.Execute('select count(*) as cuenta from regoper',
: nil, @dataResult);
:   try
:     Edit_resultado.Text := dataResult.FieldValues['cuenta'];
:   finally
:     dataResult.Free;
:   end;
: end;
:
: 그런데, C++ builder 로 해 볼려니까, 잘 안 되네요
:
: TCustomSQLDataSet* rstSet = new TCustomSQLDataSet(???);
: SQLConnection_sdi->Execute(???)
: 이런 부분이 잘 안 되는 것 같은데,
:
: 아시는 분 도움 좀 주세요
: 늘 감사합니다.

+ -

관련 글 리스트
64953 INSERT () RETURNING 값 보는 방법? 수연 1247 2011/08/10
64977     Re:INSERT () RETURNING 값 보는 방법? smleelms 974 2011/08/11
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.