The message is for C/AL programmers:
Freaky
Member Posts: 125
HI Guys, I got this error when trying to manually Run a codeunit that synchronises records from a table in Nav to a Table in SQL. This codeunit is one of the Codeunits in the SQL Synchro tool I got from Mibuso downloads it is called the "SQL Synchro Manually Run". This is the Error below
The message is for C/AL programmers:
The call to member Execute failed. Microsoft OLE DB Provider for ODBC Drivers Returned the following message:
[Microsft][ODBC SQL Server Driver][SQL Server]The COMMIT
TRANSACTION request has no corresponding BEGIN TRANSACTION.
This is the Code below
Can anyone help me out please?.
Thanks in advance.
The message is for C/AL programmers:
The call to member Execute failed. Microsoft OLE DB Provider for ODBC Drivers Returned the following message:
[Microsft][ODBC SQL Server Driver][SQL Server]The COMMIT
TRANSACTION request has no corresponding BEGIN TRANSACTION.
This is the Code below
Documentation()--->Trigger
OnRun()--->Trigger
tSQLCommit := 'COMMIT;';
iTeller := 0;
bolDelete := FALSE;
IF NOT ISCLEAR(adoCon) THEN
IF adoCon.State <> 0 THEN
adoCon.Close;
CLEAR(adoCon);
CREATE(adoCon);
recSynchroParams.RESET;
IF recSynchroParams.GET() THEN
bolDelete := recSynchroParams."Delete Lines";
adoCon.Open(cunSynchroFunctions.GetConnString);
recSynchroBuffer.RESET;
recSynchroBuffer.SETCURRENTKEY(Executed);
recSynchroBuffer.SETFILTER(Executed,'%1',FALSE);
recSynchroBuffer.LOCKTABLE;
IF recSynchroBuffer.FIND('-') THEN BEGIN
REPEAT
IF (STRPOS(UPPERCASE(recSynchroBuffer.Part1),'DELETE') <> 0) OR (STRPOS(UPPERCASE(recSynchroBuffer.Part1),'INSERT') <> 0) THEN
COMMIT;
tSQL := recSynchroBuffer.Part1 + recSynchroBuffer.Part2 + recSynchroBuffer.Part3 + recSynchroBuffer.Part4;
tSQL += recSynchroBuffer.Part5;
tSQL2 := recSynchroBuffer.Part6 + recSynchroBuffer.Part7 + recSynchroBuffer.Part8 + recSynchroBuffer.Part9;
tSQL2 += recSynchroBuffer.Part10;
adoCon.Execute(tSQL+tSQL2);
adoCon.Execute(tSQLCommit);
IF bolDelete THEN BEGIN
recSynchroBuffer.DELETE;
END ELSE BEGIN
recSynchroBuffer.Executed := TRUE;
recSynchroBuffer.MODIFY;
END;
iTeller += 1;
IF iTeller MOD 100 = 0 THEN BEGIN
COMMIT;
SLEEP(200);
END ELSE
IF (STRPOS(UPPERCASE(recSynchroBuffer.Part1),'DELETE') <> 0) OR (STRPOS(UPPERCASE(recSynchroBuffer.Part1),'INSERT') <> 0)
THEN
COMMIT;
recSynchroBuffer.LOCKTABLE;
UNTIL NOT recSynchroBuffer.FIND('-');
COMMIT;
END;
COMMIT;
adoCon.Close;
CLEAR(adoCon);
ErrorHandler()--->Trigger
adoCon.Close;
CLEAR(adoCon);
recSynchroBuffer.Executed := TRUE;
recSynchroBuffer.Error := TRUE;
recSynchroBuffer.MODIFY;
Can anyone help me out please?.
Thanks in advance.
0
Answers
-
Hi Freaky,
what version of Nav are you using?0 -
Am Using Nav 4.0
Thanks.0 -
"manually Run a codeunit that synchronises records from a table in Nav to a Table in SQL"
Is it on the same database OR different DB and are they all Nav?0 -
It looks like you are using COMMIT rather freely. Do you actually need all of those? You should only use a COMMIT statement when absolutely necessary.0
-
Thanks Guys solved it.Just commented
//adoCon.Execute(tSQLCommit).0 -
Good Job! =D>0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
