Hello all, I try to call a Stored Procedure within the SQLServer DB and I found an example how to call it by using the MSSQLDMO Object Library. Unfortunetally this example doesn´t show how to hand over parameters to the Stored Procedure. Can anybody provide me with some hints? Thanks.
Well, we use MSADO to connect a SQL Server and to execute any kind of SQL statements, thus also stored procedures. ADOConnection, Type: Automation, Subtype: ‘Microsoft ActiveX Data Objects 2.7 Library’.Connection Within the code we build the SQL statements as a text string; e.g. Statement := STRSUBSTNO(‘exec sp_who %1’, ProcessID); The we “fire” this with
RecordsAffected := 0; // Command Option Values: // adCmdFile : 256 = Evaluate as a previously persisted file // adCmdStoredProc : 4 = Evaluate as a stored procedure // adCmdTable : 2 = Have the provider generate a SQL query and return all rows from the specified table // adCmdTableDirect : 512 = Return all rows from the specified table // adCmdText : 1 = Evaluate as a textual definition // adCmdUnknown : 8 = The type of the CommandText parameter is unknown // adCmdUnspecified : -1 = Default, does not specify how to evaluate Options := 1; ADOConnection.Execute(Statement,RecordsAffected,Options);