unit uWrite;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Grids, DBGrids, Db, DBTables, Buttons;
type
TWriteForm = class(TForm)
ChaJu: TLabel;
ChaNum: TLabel;
chaJong: TLabel;
ChaColor: TLabel;
JungbiDate: TLabel;
AccidentAdd: TLabel;
ChaDate: TLabel;
Tel: TLabel;
WhanBul: TLabel;
MieBul: TLabel;
ipGo: TLabel;
ChulGo: TLabel;
GroupBox1: TGroupBox;
SoGae: TLabel;
ChuLie: TLabel;
BoHumCom: TLabel;
JubSuNum: TLabel;
DamDang: TLabel;
DamDangTel: TLabel;
ChaJuEdit: TEdit;
ChaNumEdit: TEdit;
ChaJongEdit: TEdit;
JungBiDateEdit: TEdit;
AccidentAddEdit: TEdit;
ChaDateEdit: TEdit;
TelEdit: TEdit;
WhanBulEdit: TEdit;
MieBulEdit: TEdit;
ChaColorEdit: TEdit;
SoGaeEdit: TEdit;
ChuLieEdit: TEdit;
BoHumComEdit: TEdit;
JubSuNumEdit: TEdit;
DamDangEdit: TEdit;
DamDangTelEdit: TEdit;
IpGoEdit: TEdit;
ChuGoEdit: TEdit;
Table1: TTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Query1: TQuery;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
WriteForm: TWriteForm;
implementation
{$R *.DFM}
procedure TWriteForm.BitBtn1Click(Sender: TObject);
var
SqlStr : string;
begin
SqlStr := 'insert into Table1 (차주성명, 차량번호, 차량종류, 차량색상, 정비일자, 사고장소, 차량년월식, 연락처, 완불, 미불, 소개처, 보험처리차량, 보험회사, 접수번호, 담당자, 담당자연락처, 입고날짜, 출고날짜)'+
' values ( '''+ChaJuEdit.text+''','+
' '''+ChaNumEdit.text+''','+
' '''+ChaJongEdit.text+''','+
' '''+ChaColorEdit.text+''','+
' '''+JungBiDateEdit.text+''','+
' '''+AccidentAddedit.text+''','+
' '''+ChaDateedit.text+''','+
' '''+Teledit.text+''','+
' '''+WhanBuledit.text+''','+
' '''+MieBuledit.text+''','+
' '''+SoGaeedit.text+''','+
' '''+Chulieedit.text+''','+
' '''+BoHumComedit.text+''','+
' '''+JubSuNumedit.text+''','+
' '''+DamDangedit.text+''','+
' '''+DamDangTeledit.text+''')';
Query1.Close;
Query1.Sql.Clear;
Query1.Sql.Add(SqlStr);
Query1.ExecSQL;
end;
end.
컴팔하고 실행되는데 입력하고 저장하기 버튼을 누르면 다음과 같은 에러가 납니다
sql 구문은 어느 분이 갈켜주셔서 그렇게 했답니다.
Project Taechang.exe raised exception, class EDDEngineError with message 'General SQL error.
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. '. Process stopped.
Use Step or Run to continue..
> sql 구문은 어느 분이 갈켜주셔서 그렇게 했답니다.
> Project Taechang.exe raised exception, class EDDEngineError with message 'General SQL error.
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. '. Process stopped.
> Use Step or Run to continue..
위의 소스가 현재 쓰고있는거라면..일단 필드갯수랑 밸류 갯수가 안맞고요,
싱글쿼트 로 둘러싸야 하는 디비면 QuotedStr 펑션으로 감싸준는게..
쏘쓰볼때 들 헷갈립니다.
예) ''' + Test.Text + ''' -> QuotedStr(Test.Text)