System to connect to the database is made up of ADOQuery component implementation
CodePudding user response:
That version is delphi10? Can't think up,Your question or use the IDE debugged, say so general is bad to help you solve, preliminarily concluded that SQL statements may be illegal
CodePudding user response:
Source code, there'll be debugged will know where the problem,CodePudding user response:
It is bulk import function source code, please help to check the reason, thank you!The function TStockIn. InitExcelOrder: Integer;
Var ExcelApp: Variant;
Var I, j, m, num_pro: Integer;
Var s_e1 s_e2, s_e3 s_e4, s_e5, s_e6, s_e7, s_e8, s_e9, s_e10: string;
The begin
I:=3; J:=0; Num_pro:=0;
ExcelApp:=CreateOleObject (' Excel. Application);
ExcelApp. Caption:='application calls the Microsoft Excel;
ExcelApp. WorkBooks. Open (RzOpenDialog1 FileName);
Try
ExcelApp. Worksheets [' storage import template ']. Activate;
Except,
PC. M (DATA_ACTION_ERROR); Result:=1;
Exit;
end;
While not (ExcelApp Cells [I, 9]. Value=' ') do
The begin
I:=I + 1;
Num_pro:=num_pro + 1;
end;
While j
M:=j + 3;
S_e1:=IntToStr (PC. TransProductSpecToProductID (ExcelApp. Cells [m, 1). The Value)); No.//material
S_e2:=IntToStr (PC. TransGroupNameToGroupID (ExcelApp. Cells [m, 2] Value));//location
S_e3:=ExcelApp Cells [m, 3]. The Value;//receipt number
S_e5:=ExcelApp Cells [m, 4]. The Value;//the number of
S_e4:=ExcelApp Cells [m, 5]. The Value;//batch number
S_e6:=ExcelApp Cells [m, 6]. The Value;//warehousing date
S_e7:=ExcelApp Cells [m, 7]. The Value;//production date
S_e9:=ExcelApp Cells [m, 8]. The Value;//note
S_e10:=IntToStr (PC. TransStatusNameToStatusID (ExcelApp. Cells [m, 9] Value));
S_e8:=IntToStr (PC. TransStatusNameToStatusID (ExcelApp. Cells [m, 10] Value));
With ADOQuery2 do
The begin
SQL. The Clear;
='exec SQL. Text: [dbo] [sp_quick_purchase]' + QuotedStr (s_e1) + ', '+' 5 '+', '+ QuotedStr (s_e2) +', '+ QuotedStr (s_e3) +', '+ QuotedStr (s_e4) +', '+ (s_e5) +', '+ QuotedStr (s_e6);
SQL. Text:=SQL Text + ', '+ QuotedStr (s_e7) +', '+ QuotedStr (s_e8) +', '+ QuotedStr (s_e9) +', '+ QuotedStr (s_e10);
The WriteLog (2, the Log. UserLogon (12, SYSTEM_OPERATOR, PC. NormalizeSQL (SQL. Text)));//log SQL
//PC. M (SQL Text);
ExecSQL;
//PC. DirectMSG (DATA_RETURN_MSG DATA_ADD_SUCCESSFUL);
The WriteLog (2, the Log. UserLogon (2, SYSTEM_OPERATOR, QUICK_PURCHASE));
end;
Inc (j);
end;
PC. DirectMSG (DATA_RETURN_MSG DATA_QUICK_ADD_SUCCESSFUL);
ExcelApp. ActiveWorkBook. Saved:=True;
ExcelApp. WorkBooks. Close;
ExcelApp. Quit;
ExcelApp:=the Unassigned;
RefreshGrid (0);
Result:=0;
end;