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!!
Comments
maybe this might be your problem:
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,
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
Alex
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 luck