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
[26543] 정성훈. 해미님 -> re:re[답변]EDBEngineError 내용.. (빠른답변을..--)
요구르트 [] 778 읽음    2003-08-02 16:55
aa.db 2KB DB파일입니다.(파라독스DB로 생성하니깐 두개가 생겨서 같이 올립니다.)
정말 매번 감사합니다..

질문을 자세하게 설명하라고 하셔서 아예 모두 올립니다..--;

먼저 DB파일은 Database DeskTop을 이용해서

[File]->[New]->[Table]->[Creat Table(Table type = Paradox7)] 순으로 해서 만들었습니다.
DB파일은 첨부했습니다.

소스코드..
[unit1.cpp]

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(Query1->Active) Query1->Close();

Query1->SQL->Clear();
Query1->SQL->Add("insert into aa.db");
Query1->SQL->Add("(Sn, Name)");
// 값이 전부 문자열 이라고 가정하고 한 것..
Query1->SQL->Add("Values");
Query1->SQL->Add("('" + Edit1->Text + "','" + Edit2->Text + "')");
Query1->ExecSQL();
 
Query1->Open();

}
//---------------------------------------------------------------------------




[unit1.h]

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBTables.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
        TButton *Button1;
        TQuery *Query1;
        TEdit *Edit1;
        TEdit *Edit2;
        void __fastcall Button1Click(TObject *Sender);
private:    // User declarations
public:        // User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

코드는 이렇습니다.

저번에도 말씀드렸다싶이..
일단 한번은 데이터가 입력은 되는데요..

다음엔 경고창이 뜨면서 안되더라구요.
경고창내용..
(Project Project1.exe raised exception class EDBEngineError with message 'Key
violation.'. Process stopped. Use Step or Run to continue.)

왜 안되는지 참 막막하네요..--;


p.s 삽입말고 수정에시에는 또 다른 코드가 필요한가요?
     아님 그냥 insert를 update를 바꾸면 되는 건가요?
     책에서는 그리드에 출력한걸 수정할려면 UPdateSQL을 쓰라고 나오던데..
     전 그냥 텍스트에서 정보 받아서 넣을꺼니깐 그거 쓸 필요가 없는 건가요?

+ -

관련 글 리스트
26543 정성훈. 해미님 -> re:re[답변]EDBEngineError 내용.. (빠른답변을..--) 요구르트 778 2003/08/02
26568     [답변] SQL문에서 오류... 정성훈.해미 761 2003/08/04
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.