Re: Quick code to execute an SQL stored procedure.
- From: "AliR \(VC++ MVP\)" <AliR@xxxxxxxxxxxxx>
- Date: Fri, 13 Feb 2009 09:57:05 -0600
I'm sorry, I guess I should have asked more specifically what you were
looking for before posting my answer.
There are alot of post where people don't google for an answer, and if they
do they don't tell the rest of us that they had tried an approach and it
didn't work for one reason or another.
But you are right I googled for "MFC Stored Procedure In 3 Lines of Code"
and nothing poped up. (P.S. I even tried "C++ Stored Procedure In 3 Lines of
Code" and still nothing).
AliR.
"Beamer" <BeamerS@xxxxxxxxx> wrote in message
news:ow1ll.16091$YU2.13313@xxxxxxxxxxxxxxxxxxxxxxx
First let me state that I appreciate the help that all people give in the
news groups. Especially the MVPs. It is huge job that is done well.
Your answer is worthless to me. And here is why. I know nothing about
these databases and everything you Googled for me is so complicated. I had
already Googled similarly and I have already gotten so confused. I was
hoping there would be a simple answer.
I seriously though that what I needed to do was so simple. I was hoping
that I could learn everything I needed to know in an afternoon, maybe
less. (Remember I know ZERO about databases.)
I figured that a stored procedure is like a function call to a database.
You provide some data as parameters and the procedure does its stuff and
then returns a code to you. I thought this would be just like a function
call.
So... Dummy me... Thinks that maybe this could be done in maybe... Only 3
lines of code. Silly me to think this was possible. I thought maybe the
three lines would be.
1) Code line #1. Some kind of open statement where I specify the server,
database name, login and password. I figured I'd get some kinda handle or
something.
2) Code line #2. 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. I figured I'd get a return code.
3) Code line #3. Some kind of close statement to close the database
access.
I was hoping to get an answer with those types of details. I guess I was
wrong.
So you say why would I think this??? What I remember about databases from
the past was some work I did with MySQL. I'd open a command window. I'd
execute a MySQL command giving the database name, password and stuff and
then BOOM I'm in the database. Super simple. Then I can do a SELECT
statement and BOOM I get all this data. Thats great.
I just figured how hard could it be to execute a stored procedure!
AliR (VC++ MVP) wrote:
http://support.microsoft.com/kb/183001
Let me google that for you:
http://letmegooglethatforyou.com/?q=MFC+stored+procedure
AliR.
"Beamer" <BeamerS@xxxxxxxxx> wrote in message
news:Cy%kl.10396$hc1.2087@xxxxxxxxxxxxxxxxxxxxxxx
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.
.
- References:
- Quick code to execute an SQL stored procedure.
- From: Beamer
- Re: Quick code to execute an SQL stored procedure.
- From: AliR \(VC++ MVP\)
- Re: Quick code to execute an SQL stored procedure.
- From: Beamer
- Quick code to execute an SQL stored procedure.
- Prev by Date: Re: Struggling to select an item in a CListCtrl
- Next by Date: Getting thread to stop in CDialog type class
- Previous by thread: Re: Quick code to execute an SQL stored procedure.
- Next by thread: Re: Quick code to execute an SQL stored procedure.
- Index(es):
Relevant Pages
|