我们有应用程序同步某些数据库(sqlserver)。 技术人员数据库(SQLExpress 2008 32位)和服务器端SqlServer 2008 R2 64位。
在同步应用程序中我要对某些脚本进行同步。从技术人员到服务器的数据库。 现在我收到类似[DBNETLIB] [ConnectionWrite(send())的错误。]
我已经记录了错误
--21/10/2013 11:05:12------------Update on t_intervention_mission--------------------------------
Old Values:
ID=0,RowID={06938E13-F068-437D-A454-3E17B4C7CCC6},IntCardID= NULL,IntCardRowID={69D86DD9-55E5-450F-BC72-93FE2DB5BA1E},MissionID= NULL,MissionRowID={7D1F046F-C82A-42AA-9712-00D4F7FEC5BF},Duration=CONVERT(DATETIME,'1899-12-30 00:00:00.000', 102),Number=1,InCalculation=0,KindID= NULL,KindRowID={D2BD32AD-5926-4AF6-9258-F52F453800A8},WorkTime=0,PayerReference='r',WorkOut=0,ImmovableProperty=1,VatPercent=21,DurationChange=0,DefaultMissionPrice=0,ProductCount=0,DeliverProductPrice=0,DeliverWorkPrice=0,DeliverTransportPrice=0,DeliverMissionPrice=0,DeliverTotalPrice=0,ActiveProductPrice=0,ActiveWorkPrice=0,ActiveTransportPrice=0,ActiveMissionPrice=0,ActiveTotalPrice=0,TariffID= NULL,TariffRowID= NULL,WorkCostPercent=0,WorkCostPlus=0,WorkAmountPercent=0,WorkAmountPlus=0,ProductAmountPercent=0,ProductAmountPlus=0,TransportCostPercent=0,TransportCostPlus=0,TransportAmountPercent=0,TransportAmountPlus=0,MissionAmountPercent=0,MissionAmountPlus=0,DateCreate=CONVERT(DATETIME,'2013-10-21 11:02:36.083', 102),DateChange=CONVERT(DATETIME,'2013-10-21 11:05:00.620', 102),WorkStationCreate='SIX001',WorkStationChange='SIX001',ContractPrice=0,IsSafeCondition= NULL
Script:
update t_intervention_mission set PayerReference='r',DateChange=CONVERT(DATETIME,'2013-10-21 11:05:00.620', 102) where RowID = '{06938E13-F068-437D-A454-3E17B4C7CCC6}'
--ERROR--EOleException--------------------------------------------------------------------
[DBNETLIB][ConnectionWrite (send()).]Algemene netwerkfout. Raadpleeg de netwerkdocumentatie
On script: update t_intervention_mission set PayerReference='r',DateChange=CONVERT(DATETIME,'2013-10-21 11:05:00.620', 102) where RowID = '{06938E13-F068-437D-A454-3E17B4C7CCC6}'
Connection:AdoConnectionServer
Number = -2147467259
NativeError = 11
Source = Microsoft OLE DB Provider for SQL Server
Description = [DBNETLIB][ConnectionWrite (send()).]Algemene netwerkfout. Raadpleeg de netwerkdocumentatie.
Helpfile =
SQLState = HY018
ConnectionTimeOut = 60
CommandTimeout = 120
--21/10/2013 11:05:41----------------------------------------------------------------
在日志中,脚本要进行更新。 我还在sqlserver的命令提示中设置了一个永恒的ping。 当脚本执行更新时,ping会超时。
此错误仅在我有移动宽带连接时才会出现。 当技术人员到达公司然后笔记本电脑找到公司的wifi并且脚本可以完成。 该错误仅在移动宽带连接中发生。
function TLogFile.SqlExec (StrSql : String; AdoConnection : TADOConnection; ARec: _RecordSet): Integer;
begin
Result := 0;
try
ARec := AdoConnection.Execute(StrSql, cmdText);
except
on E : Exception do
begin
E.Message:= E.Message+ craConstant.CRLF+
'On script: '+StrSql+ craConstant.CRLF+
'Connection:'+ AdoConnection.Name;
if (E.ClassType = EOleException) and (AdoConnection.Errors.Count > 0) then
begin
E.Message:= E.Message+ craConstant.CRLF+
'Number ='+IntToStr(AdoConnection.Errors[0].Number)+CRLF+
'NativeError ='+IntToStr(AdoConnection.Errors[0].NativeError)+CRLF+
'Source ='+AdoConnection.Errors[0].Source+CRLF+
'Description ='+AdoConnection.Errors[0].Description+CRLF+
'Helpfile ='+AdoConnection.Errors[0].HelpFile+CRLF+
'SQLState ='+AdoConnection.Errors[0].SQLState;
end;
self.HndException:= E;
Result := -1;
raise;
end;
end;
end;
我在sqlexec函数中做了一些更改:
function TLogFile.SqlExec (StrSql : String; AdoConnection : TADOConnection): Integer;
var
oQuerySql: TADOQuery;
begin
Result := 0;
oQuerySql:= TADOQuery.Create(Nil);
try
oQuerySql.Connection:= AdoConnection;
oQuerySql.CommandTimeout:= AdoConnection.CommandTimeout;
oQuerySql.SQL.Add(StrSql);
try
oQuerySql.ExecSQL;
except
on E : Exception do
begin
E.Message:= E.Message+ craConstant.CRLF+
'On script: '+StrSql+ craConstant.CRLF+
'Connection:'+ AdoConnection.Name;
if (E.ClassType = EOleException) and (AdoConnection.Errors.Count > 0) then
begin
E.Message:= E.Message+ craConstant.CRLF+
'Number = '+IntToStr(AdoConnection.Errors[0].Number)+CRLF+
'NativeError = '+IntToStr(AdoConnection.Errors[0].NativeError)+CRLF+
'Source = '+AdoConnection.Errors[0].Source+CRLF+
'Description = '+AdoConnection.Errors[0].Description+CRLF+
'Helpfile = '+AdoConnection.Errors[0].HelpFile+CRLF+
'SQLState = '+AdoConnection.Errors[0].SQLState+CRLF+
'ConnectionTimeOut = '+IntToStr(AdoConnection.ConnectionTimeout) +CRLF+
'CommandTimeout = '+IntToStr(AdoConnection.CommandTimeout);
end;
self.HndException:= E;
Result := -1;
raise;
end;
end;
finally
FreeAndNil(oQuerySql);
end;
end;
此更改在3天内没问题,现在我在
等插入脚本上找回错误--21/10/2013 14:11:05------------Insert on t_intervention_mission----------------------------------------------------
Old Values:
ID=0,RowID={53C5780D-B683-45C9-B942-018091DD0435},IntCardID= NULL,IntCardRowID={0709FB3B-1CDD-4E2B-BAC6-4FB6A952F788},MissionID= NULL,MissionRowID={C24234F2-DD1F-4B3B-B81D-3D13384CC573},Duration=CONVERT(DATETIME,'1899-12-30 00:20:00.000', 102),Number=1,InCalculation=0,KindID= NULL,KindRowID={77387E4C-604A-4653-B490-38A6B9C5A8E5},WorkTime=0,PayerReference= NULL,WorkOut=1,ImmovableProperty=1,VatPercent=0,DurationChange=0,DefaultMissionPrice=0,ProductCount=0,DeliverProductPrice=0,DeliverWorkPrice=0,DeliverTransportPrice=0,DeliverMissionPrice=0,DeliverTotalPrice=0,ActiveProductPrice=0,ActiveWorkPrice=13.54,ActiveTransportPrice=11.01,ActiveMissionPrice=0,ActiveTotalPrice=24.55,TariffID= NULL,TariffRowID={DADB09D9-A760-4213-98AA-47E090EAB1FD},WorkCostPercent=0,WorkCostPlus=0,WorkAmountPercent=30,WorkAmountPlus=0,ProductAmountPercent=0,ProductAmountPlus=0,TransportCostPercent=0,TransportCostPlus=0,TransportAmountPercent=0,TransportAmountPlus=0,MissionAmountPercent=0,MissionAmountPlus=0,DateCreate=CONVERT(DATETIME,'2013-09-02 08:37:54.530', 102),DateChange=CONVERT(DATETIME,'2013-09-02 08:38:06.460', 102),WorkStationCreate='SIX001',WorkStationChange='SIX001',ContractPrice=0,IsSafeCondition= NULL
Script:
insert into t_intervention_mission (RowID,IntCardRowID,MissionRowID,Duration,Number,InCalculation,KindRowID,WorkTime,WorkOut,ImmovableProperty,VatPercent,DurationChange,DefaultMissionPrice,ProductCount,DeliverProductPrice,DeliverWorkPrice,DeliverTransportPrice,DeliverMissionPrice,DeliverTotalPrice,ActiveProductPrice,ActiveWorkPrice,ActiveTransportPrice,ActiveMissionPrice,ActiveTotalPrice,TariffRowID,WorkCostPercent,WorkCostPlus,WorkAmountPercent,WorkAmountPlus,ProductAmountPercent,ProductAmountPlus,TransportCostPercent,TransportCostPlus,TransportAmountPercent,TransportAmountPlus,MissionAmountPercent,MissionAmountPlus,DateCreate,DateChange,WorkStationCreate,WorkStationChange,ContractPrice) values ('{53C5780D-B683-45C9-B942-018091DD0435}','{0709FB3B-1CDD-4E2B-BAC6-4FB6A952F788}','{C24234F2-DD1F-4B3B-B81D-3D13384CC573}',CONVERT(DATETIME,'1899-12-30 00:20:00.000', 102),1,0,'{77387E4C-604A-4653-B490-38A6B9C5A8E5}',0,1,1,0,0,0,0,0,0,0,0,0,0,13.54,11.01,0,24.55,'{DADB09D9-A760-4213-98AA-47E090EAB1FD}',0,0,30,0,0,0,0,0,0,0,0,0,CONVERT(DATETIME,'2013-09-02 08:37:54.530', 102),CONVERT(DATETIME,'2013-09-02 08:38:06.460', 102),'SIX001','SIX001',0)
--ERROR--EOleException--------------------------------------------------------------------
[DBNETLIB][ConnectionWrite (send()).]Algemene netwerkfout. Raadpleeg de netwerkdocumentatie
On script: insert into t_intervention_mission (RowID,IntCardRowID,MissionRowID,Duration,Number,InCalculation,KindRowID,WorkTime,WorkOut,ImmovableProperty,VatPercent,DurationChange,DefaultMissionPrice,ProductCount,DeliverProductPrice,DeliverWorkPrice,DeliverTransportPrice,DeliverMissionPrice,DeliverTotalPrice,ActiveProductPrice,ActiveWorkPrice,ActiveTransportPrice,ActiveMissionPrice,ActiveTotalPrice,TariffRowID,WorkCostPercent,WorkCostPlus,WorkAmountPercent,WorkAmountPlus,ProductAmountPercent,ProductAmountPlus,TransportCostPercent,TransportCostPlus,TransportAmountPercent,TransportAmountPlus,MissionAmountPercent,MissionAmountPlus,DateCreate,DateChange,WorkStationCreate,WorkStationChange,ContractPrice) values ('{53C5780D-B683-45C9-B942-018091DD0435}','{0709FB3B-1CDD-4E2B-BAC6-4FB6A952F788}','{C24234F2-DD1F-4B3B-B81D-3D13384CC573}',CONVERT(DATETIME,'1899-12-30 00:20:00.000', 102),1,0,'{77387E4C-604A-4653-B490-38A6B9C5A8E5}',0,1,1,0,0,0,0,0,0,0,0,0,0,13.54,11.01,0,24.55,'{DADB09D9-A760-4213-98AA-47E090EAB1FD}',0,0,30,0,0,0,0,0,0,0,0,0,CONVERT(DATETIME,'2013-09-02 08:37:54.530', 102),CONVERT(DATETIME,'2013-09-02 08:38:06.460', 102),'SIX001','SIX001',0)
Connection:AdoConnectionServer
Number =-2147467259
NativeError =11
Source =Microsoft OLE DB Provider for SQL Server
Description =[DBNETLIB][ConnectionWrite (send()).]Algemene netwerkfout. Raadpleeg de netwerkdocumentatie.
Helpfile =
SQLState =HY018
--21/10/2013 14:11:37----------------------------------------------------------------
我找到了地板上的技术人员。我使用旧函数TLogFile.SqlExec(StrSql:String; AdoConnection:TADOConnection; ARec:_RecordSet)运行旧的同步应用程序:整数; 并且脚本不会给我一个错误。 AdoConnection.Execute(StrSql,cmdText)VS oQuerySql.ExecSQL有什么问题; adoconnection和脚本是在一个线程中完成的。
在较旧的笔记本电脑(Windows XP)上,我没有这个问题。 仅适用于装有Windows7的新笔记本电脑。
如果有人可以给我一些澄清或提示在哪里搜索问题。我会很感激的。 “SQL Server Native Client 10.0”和“Microsoft OLE DB Provider for SQL Server”之间是否存在差异。
对于同步,我使用'Microsoft OLE DB Provider for SQL Server'
答案 0 :(得分:0)
我向笔记本电脑公司(松下)提出这个问题。 松下给我一个固件更新和驱动程序安装,这解决了这个问题。 我不再收到网络错误了。