Quick code to execute an SQL stored procedure.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I haven't written code to access a database in many years. I now have a requirement in my MFC version 6 program to execute a stored procedure. The database is Microsoft SQL Server 2005. I know the server name, database name, login and password. I also know the sored procedure name and the parameters.

How exactly do I execute the stored procedure? I assume I need to open the database and then do something to execute the stored procedure.
.



Relevant Pages

  • Re: Quick code to execute an SQL stored procedure.
    ... There are alot of post where people don't google for an answer, ... But you are right I googled for "MFC Stored Procedure In 3 Lines of Code" ... I figured that a stored procedure is like a function call to a database. ... I'd use the handle and then call some kind of execute ...
    (microsoft.public.vc.mfc)
  • Re: Execute stored procedure only
    ... You need CONNECT capability to be able to get into the database and execute ... You can compare this to having permission to eat a piece of pie, ... Should I not be able to just execute SP through QA? ... right to execute stored procedure in database called "mydatabase". ...
    (microsoft.public.sqlserver.security)
  • Re: Quick code to execute an SQL stored procedure.
    ... Especially the MVPs. ... Some kind of open statement where I specify the server, database name, login and password. ... I'd use the handle and then call some kind of execute command or something where I specify the name of the stored procedure and the parameters. ...
    (microsoft.public.vc.mfc)
  • Could not find stored procedure error
    ... I can execute a select query on a database but ... I get an error when I try to execute a stored procedure. ... database which is preventing it from finding my stored procedures. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Stored Prcedure Security
    ... There is a section in BOL regarding cross database ownership chains and the ... > permission to read either table; ... > permission to execute the stored procedure, ...
    (microsoft.public.sqlserver.programming)