connecting to SQL 2000 via NAV3.70 B and ADO 2.8

herrlutz
Member Posts: 58
Dear all,
i know it´s a request from the museum but maybe there´s someone who can help
i try to run the following code and it stops with an error in the last line:
IF ISCLEAR(Conn) THEN CREATE(Conn);
Conn.ConnectionString:='Driver={SQL Server};Server=MySQLInstance;Database=myDbName;User Id=myUser;Password=myPassword'
Conn.Open;
IF ISCLEAR(ADODBCmdAR) THEN
CREATE(ADODBCmdAR);
lvarActiveConnection:=Conn;
ADODBCmdAR.ActiveConnection:=lvarActiveConnection;
ADODBCmdAR.CommandTimeout := 0;
ADODBCmdAR.Parameters.Refresh;
ADODBCmdAR.CommandType := 4;
ADODBCmdAR.CommandText := 'sp_setapprole';
ADODBCmdAR.Parameters.Append(ADODBCmdAR.CreateParameter('@rolename', 200, 1, 150, 'MyRoleName'));
--> and this is where following error appears:
"Could not invoke the member append. The OLE control or Automation server returned the following message: The requested member does not exist, or the call tried to set the value of a read-only property"
when running the same ADO- Command via Excel- VBA on the same computer where the Navision client is running the program does complete normally
Any hints are very welcome (except recommending "You have to upgrade to a newer NAV version" - i know it will run there :^o )
thanks and happy new year!!
i know it´s a request from the museum but maybe there´s someone who can help
i try to run the following code and it stops with an error in the last line:
IF ISCLEAR(Conn) THEN CREATE(Conn);
Conn.ConnectionString:='Driver={SQL Server};Server=MySQLInstance;Database=myDbName;User Id=myUser;Password=myPassword'
Conn.Open;
IF ISCLEAR(ADODBCmdAR) THEN
CREATE(ADODBCmdAR);
lvarActiveConnection:=Conn;
ADODBCmdAR.ActiveConnection:=lvarActiveConnection;
ADODBCmdAR.CommandTimeout := 0;
ADODBCmdAR.Parameters.Refresh;
ADODBCmdAR.CommandType := 4;
ADODBCmdAR.CommandText := 'sp_setapprole';
ADODBCmdAR.Parameters.Append(ADODBCmdAR.CreateParameter('@rolename', 200, 1, 150, 'MyRoleName'));
--> and this is where following error appears:
"Could not invoke the member append. The OLE control or Automation server returned the following message: The requested member does not exist, or the call tried to set the value of a read-only property"
when running the same ADO- Command via Excel- VBA on the same computer where the Navision client is running the program does complete normally
Any hints are very welcome (except recommending "You have to upgrade to a newer NAV version" - i know it will run there :^o )
thanks and happy new year!!
0
Comments
-
Hi,
maybe this might be your problem:ADODBCmdAR.Parameters.Refresh;
ADODBCmdAR.CommandType := 4;
ADODBCmdAR.CommandText := 'sp_setapprole';
Include the path to stored procedure for the CommandText property to point directly to the stored procedure.
for example : ADODBCmd.CommandText := 'master.dbo.sp_setapprole';
I hope this helps.
Regards,
WillyFostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.0 -
Dear Willy,
thanks for your hint, but unfortunately i get the same error message also if i add the database name as you described.
it seems very strange that running other stored procedure without parameters will work, while all stored procedures create this error when trying to append parameters.
regards
Alex0 -
Hi herrlutz,
1. Declare a variable
VarADOParameter type Automation 'Microsoft ActiveX Data Objects 2.8 Library'.Parameter
2. Replace :
ADODBCmdAR.Parameters.Append(ADODBCmdAR.CreateParameter('@rolename', 200, 1, 150, 'MyRoleName'));
by
VarADOParameter:=ADODBCmdAR.CreateParameter('@rolename', 200, 1, 150, 'MyRoleName');
ADODBCmdAR.Parameters.Append(VarADOParameter);
Good luckHKAMEL0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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