ACTS on the archived record to the server after trading on SQL2008
LAN environment to use without any problems,
But recently the server migration to the lost rows ali cloud server often happen
Code to perform in a local area network (LAN) environment for many years without any exception, and data missing problem,
(the actual use environment may have problems, poor quality of Internet access)
TmpTableName:=SystemSetup. DataATableName;
//insert the remote server table tmpTableName
TmpSQLStr:='insert into' + tmpTableName + '(did, dinsetcode, dno, ddate, dtime, dnum)';
DM.ADODealComm.Com mandText:=tmpSQLStr;
DM. ADODealComm. Prepared:=True;
{$# IFNDEF BDE}
If SystemSetup. BakData then
The begin
TmpSQLStr:="insert into hs_000ahistory (did, dbarcode, dno, ddate, dtime, dnum) ';
TADOQuery (DM TableAHistory). SQL. Text:=tmpSQLStr;
TADOQUERY (DM) TableAHistory)) Prepared:=True;
end;
{$ENDIF}
DM. TableA. First;
ARecordCount:=0;
While (not DM. TableA. Eof) and (not tmpError) do
The begin
//write to the server,
If ALimit then
The begin
ARecordCount:=ARecordCount + 1;
If ARecordCount & gt; Then 100
Break;
end;
With DM. ADODealComm. The Parameters of the DM. TableA do
The begin
ParamByName (' did '). The Value:=FieldByName (' did '). AsString;
ParamByName (' dbarcode '). The Value:=FieldByName (' dbarcode). AsString;
ParamByName (' dNo '). The Value:=FieldByName (' dNo). AsString;
ParamByName (' dDate). The Value:=FieldByName (' dDate). AsDateTime;
ParamByName (' dtime). The Value:=FieldByName (' dtime). AsString;
ParamByName (' dnum). The Value:=FieldByName (' dnum). AsVariant;
end;
DM. ADODealComm. Execute;
//data has indeed phenomenon, such as the deal 10 rows
//the actual remote server after the deal only seven rows or no record
//tried TADOQuery (dm) ADODealComm). RowsAffected & lt;> 1 log
//record found the deal 10 log write 10 times is equivalent to 10 are not write data records,
{$# IFNDEF BDE}
If SystemSetup. BakData then
The begin
With TADOQuery (DM TableAHistory). The Parameters, the DM. TableA do
The begin
ParamByName (' did '). The Value:=FieldByName (' did '). AsString;
ParamByName (' dbarcode '). The Value:=FieldByName (' dbarcode). AsString;
ParamByName (' dNo '). The Value:=FieldByName (' dNo). AsString;
ParamByName (' dDate). The Value:=FieldByName (' dDate). AsDateTime;
ParamByName (' dtime). The Value:=FieldByName (' dtime). AsString;
ParamByName (' dnum). The Value:=FieldByName (' dnum). AsVariant;
end;//with
TADOQuery (DM) TableAHistory). ExecSQL;
//local backup data without any problems, no data is lost,
end;
{$ENDIF}
DM. TableA. Delete;
end;
CodePudding user response:
1, first of all, can add a try see throw an error2 don't table, try the query
CodePudding user response:
The business generally call services on the server wants relatively safer,Using ADO to connect the cloud database straight or restricted, if to 5 g era should be good,
CodePudding user response:
Directly connect the network database, access to slow and easy to drop problems, you haven't open transaction backup, especially writing, due to the interaction of multiple, speed is very slow, if the middle a quantity of bolt, only some of the data are updated.CodePudding user response:
Do not directly connected networks outside, one is unsafe, and is too slow,If the program code didn't want to change the old code, you can download the satrda middleware, modify the connection string on foreign web updates can accelerate dozens of one hundred times,
Refer to this link to change
https://blog.csdn.net/pcwe2002/article/details/52527782
CodePudding user response:
The database is exposed in die, multi-user environment directly connect to the database nor desirable,