The following is this code:
Procedure TSPRKXX. SpeedButton1Click (Sender: TObject);//quantity add
The begin
With the DM. QSPRK do
The begin
The Close;
SQL. The Add (' insert into InStoreProduct (incoming number, article number, name of commodity, category, products specifications, the commodity unit, unit price, inventory quantity, total price, name of handlers, warehousing date, note) ');
SQL. The Add (' Values (: a: b: c: d, e, f, : g: h,,,, j, k, : l) ');
The Parameters. ParamByName (' a '). The Value:='fairly RK' + Edit1. Text + FormatDateTime (' yyyymmdd ', Now ());//warehousing number
The Parameters. ParamByName (' b '). The Value:=Trim (Edit2. Text);//product id
The Parameters. ParamByName (' c '). The Value:=Trim (ComboBox2. Text);//commodity name
The Parameters. ParamByName (' d '). The Value:=Trim (Edit3. Text);//category
The Parameters. ParamByName (' e '). The Value:=Trim (Edit4. Text);//commodity specification
The Parameters. ParamByName (' f '). The Value:=Edit5. Text;//commodity unit is to write the field into database
The Parameters. ParamByName (" g "). The Value:=StrToFloat (Trim (Edit6. Text));//unit price
The Parameters. ParamByName (' h '). The Value:=StrToInt (Trim (Edit7. Text));//storage quantity
The Parameters. ParamByName (' I '). The Value:=StrToFloat (Trim (Edit8. Text));//total price
The Parameters. ParamByName (' j '). The Value:=Edit11. Text;//handlers number
The Parameters. ParamByName (' k '). The Value:=StrToDateTime (Trim (Edit10. Text));
The Parameters. ParamByName (' l '). The Value:=Memo1. Text;//note
ExecSQL;
ShowMessage (' add quantity success! ')
end;
end;
CodePudding user response:
Check a product unit field type and length, the other edit5. Whether the text input characters,CodePudding user response:
Is not the same as the other, there is no trimCodePudding user response:
Suggest you to collect the SQL statement, and then run the SQL environment, see where the problem:In ExecSQL; Before adding 1:
Memo2. Lines. The add (SQL text);
Add a memo2 control, after the operation post memo2 SQL statements, the will know where the problem,
This method is applicable to check error,
In addition, other field length should be 1 # said questions, or edit the serial number corresponding to the problem,
CodePudding user response:
1, with DM QSPRK doThe close;
SQL. The clear;
SQL. The add ();
SQL. Execsql;
end;
Add the clear
2, Edit5. Try Text into a fixed value, such as "test unit",
CodePudding user response:
Add a codeShowmessage (Edit5. Text);
Perform check whether Edit5 Tex no character,
CodePudding user response:
1, database table field type is what? How much length?2, tracking, to this row, Edit5. What is the value of the text
Clear up these first, and tell us