ADOConnection on serverice tier (RTC)
ara3n
Member Posts: 9,258
Hello
Has anybody tried and run the ADO automation on service tier?
viewtopic.php?f=5&t=23038&hilit=lADOConnection
Based on this example, this doesn't work on RTC but works fine on classic.
The error is
If I change the code to
The compiler errors out
Has anybody tried and run the ADO automation on service tier?
viewtopic.php?f=5&t=23038&hilit=lADOConnection
Based on this example, this doesn't work on RTC but works fine on classic.
//lvarActiveConnection is of type variant lvarActiveConnection := lADOConnection; //this is where it errors out when on RTC lADOCommand.ActiveConnection := lvarActiveConnection;
The error is
The expression Variant cannot be type-converted to a String value.
If I change the code to
lADOCommand.ActiveConnection := lADOConnection;
The compiler errors out
Type conversion is not possible because 1 of the operators contains an invalid type.
Integer := Automation
0
Comments
-
So nobody has tried to use ADO automation on RTC?0
-
I have seen ADO connection on a NAV Module (Orderbase) and i encountered problems with it, because classic & Service Tier seem to handle the automation different.
I can't tell you whats the problem, but what i have seen is that there has changed things from classic to RTC.
Unfortunatly in the code i've seen the ADOConnection var is not further assigned to a var of type Command, execute is directly called with a string in it, so no solution for your problem, sorry...0 -
Thanks. For right now I'll run the solution on NAS. I will see if I can find another solution. Probably .NET framework.0
-
We run this and have stumbled upon same error.
We are planing to run the automation with NAS service to go around it.K.S.0 -
0
-
Nifty,
I actually found another solution for this which seems to work fine. I made a simple test with it too for retreaving customer names to another test table:
Here is the code:{ // Globals: txtQuery Text 250 autADOConnection Automation 'Microsoft ActiveX Data Objects 2.8 Library'.Connection autADORecordSet Automation 'Microsoft ActiveX Data Objects 2.8 Library'.Recordset recTestitaulu Record testi } // SQL Kyselyn alustus / SQL Query txtQuery := 'SELECT * FROM [Your Company$Customer]'; // Customer table for the test // Automaatioiden alustus / Automation creations CREATE(autADOConnection); CREATE(autADORecordSet); // Tietokantayhteys / Database connection string autADOConnection.ConnectionString := 'Driver={SQL Server};' + 'Server='+'PalvelimenNimi'+';' // Server name + 'Database='+'TietokannanNimi'+';' // Database name + 'Uid=UserName;' // Query user (remember rights) + 'Pwd=UserPassword;'; // user's password // Tietokantayhteyden avaus / DB connection open autADOConnection.Open; // SQL Kyselyn ajo avattuun kantaan sekä tietojen tuonti RecordSet Automaatiomuuttujaan / Query execution and retreaval for record set autADORecordSet := autADOConnection.Execute(txtQuery); recTestitaulu.RESET; // Looppi RecordSetin läpi / Loop through record set WHILE NOT autADORecordSet.EOF DO BEGIN // Uuden rivin luonti testitauluun / New line per record recTestitaulu.INIT; recTestitaulu.No := autADORecordSet.Fields.Item('No_').Value; // Perusavain Sarake 1 / Prikey yada yada recTestitaulu.Name := autADORecordSet.Fields.Item('Name').Value; // Nimi tieto Sarake 2 / some value recTestitaulu.INSERT; autADORecordSet.MoveNext; // Siirtymä seuraavaan RecordSetin riviin / next record END; autADOConnection.Close;K.S.0 -
ara3n wrote:
//lvarActiveConnection is of type variant lvarActiveConnection := lADOConnection; //this is where it errors out when on RTC lADOCommand.ActiveConnection := lvarActiveConnection;
The error is
The expression Variant cannot be type-converted to a String value.
Greetings,
I run into this all the time. I think it is an incompatibility between design and execution in the compiled code of the program. (A Bug.)
My resolution is so simple that it's silly. Nonetheless, it works.
I save my code object without compiling. I re-open the object and compile it. It has taken several attempts at times to get this to work. Eventually, I always win over the machine.
Once I remember closing Navision entirely and re-opening the application and re-opening the object before it would compile without the nasty little error message.Enrico's Folly
Heat = Work
And all things tend to chaos0 -
I just tried it with an ADO connection that works on the classic client.
On the RTC, somehow it does even not find the data source. From where does it select the data source, shouldn't it be selected from the client?0 -
ara3n wrote:
hi ara3n,
What is the dotnet type (subtype) you have used to declare the variables (sqlconnection for example)?
thanks in advance0 -
System.Data.SqlClient.SqlConnection0
-
Hello ara3n ,
I am trying to access the http://mibuso.com/blogs/ara3n/2011/01/1 ... tc-in-nav/ site but it's not available. Can you please provide the address again.
Thanks
Bhavna0
Categories
- All Categories
- 75 General
- 75 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
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions