Click here to Skip to main content
16,008,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaldialogs Pin
Member 169273510-Feb-05 10:38
Member 169273510-Feb-05 10:38 
GeneralRe: dialogs Pin
David Crow10-Feb-05 11:14
David Crow10-Feb-05 11:14 
GeneralOwner Draw Crashing Pin
sir kaber10-Feb-05 10:34
sir kaber10-Feb-05 10:34 
GeneralRe: Owner Draw Crashing Pin
sir kaber10-Feb-05 10:56
sir kaber10-Feb-05 10:56 
GeneralVC++ (6.0, .NET) USB device IO Pin
bwray10-Feb-05 9:56
bwray10-Feb-05 9:56 
GeneralRe: VC++ (6.0, .NET) USB device IO Pin
tssp10-Feb-05 17:19
tssp10-Feb-05 17:19 
GeneralRe: VC++ (6.0, .NET) USB device IO Pin
Elmue4-Dec-09 8:03
Elmue4-Dec-09 8:03 
GeneralRetreiving return value from stored procedure in C++ Pin
rick742310-Feb-05 8:46
rick742310-Feb-05 8:46 
I have a stored procedure on a MSSQL2K server that will perform 2 processes. I am doing a check of the processes and will return an int value which specifies whether the processes completed properly, i.e.
return val - Meaning
0 - both processes failed
1 - the first process completed but the second failed
10 - the second completed but the first failed
11 - indicates both passed

The SP uses the return keyword as in:
<br />
USE myDB<br />
IF EXISTS (SELECT name FROM sysobjects <br />
         WHERE name = 'updatedata' AND type = 'P')<br />
   DROP PROCEDURE updatedata<br />
GO<br />
USE myDB<br />
GO<br />
CREATE PROCEDURE updatedata <br />
   @n1 decimal,<br />
   @n2 decimal,<br />
   @n3 varchar(25),<br />
    <br />
AS <br />
<br />
set nocount on<br />
<br />
DECLARE @m1 int<br />
DECLARE @m2 int<br />
<br />
... do initial process ....<br />
<br />
select @m1 = (select count(*) from table <br />
	      where params match)<br />
// @m1 should = 1<br />
<br />
... do second process ...<br />
<br />
select @m2 = 10 * (select count(*) from table <br />
	      where params match)<br />
// @m2 should = 10<br />
<br />
return (@md + @mdh)<br />
// should return 11 to calling app<br />
<br />
GO<br />
<br />


using following the TSQL string in query analyzer returns the results correctly:
<br />
declare @val int<br />
exec @val = updatedata 101002, 105041, 'some part number'<br />
select @val as 'val'<br />


In VC/C++, I am using ADO and the open function to call the SP. I need to know how to format the syntax so the return value is returned to be evaluated.

Considering using this function:
<br />
// RS1 is the recordset object<br />
char rsSQL[256];<br />
sprintf(rsSQL,"exec updateData %d, %d, %s", (long)tme, (long)jdt, cmLITM);<br />
RS1->Open(rsSQL, vtMissing, adOpenKeyset, adLockBatchOptimistic, -1);<br />

How can I change this to get the data returned correctly?

Thanks in advance.

There are 10 kinds of people, those that understand binary and those that don't.
Generaldelete one character in file Pin
six_billion10-Feb-05 8:30
six_billion10-Feb-05 8:30 
GeneralRe: delete one character in file Pin
David Crow10-Feb-05 9:06
David Crow10-Feb-05 9:06 
GeneralRe: delete one character in file Pin
Maximilien10-Feb-05 9:07
Maximilien10-Feb-05 9:07 
GeneralRe: delete one character in file Pin
Neville Franks10-Feb-05 9:27
Neville Franks10-Feb-05 9:27 
GeneralPrinting a Windows Form in Visual C++ .net 2003 Pin
Kevin9010-Feb-05 7:14
Kevin9010-Feb-05 7:14 
Generalsearching concrete text in *.txt file Pin
bilas10-Feb-05 6:39
bilas10-Feb-05 6:39 
GeneralRe: searching concrete text in *.txt file Pin
Ravi Bhavnani10-Feb-05 6:42
professionalRavi Bhavnani10-Feb-05 6:42 
GeneralRe: searching concrete text in *.txt file Pin
bilas10-Feb-05 6:45
bilas10-Feb-05 6:45 
GeneralDateTimePicker error debugging Pin
José Luis Sogorb10-Feb-05 6:23
José Luis Sogorb10-Feb-05 6:23 
GeneralRe: DateTimePicker error debugging Pin
Steve Mayfield10-Feb-05 7:08
Steve Mayfield10-Feb-05 7:08 
GeneralRe: DateTimePicker error debugging Pin
José Luis Sogorb10-Feb-05 7:12
José Luis Sogorb10-Feb-05 7:12 
GeneralRe: DateTimePicker error debugging Pin
Steve Mayfield10-Feb-05 7:39
Steve Mayfield10-Feb-05 7:39 
GeneralRe: DateTimePicker error debugging Pin
José Luis Sogorb10-Feb-05 22:18
José Luis Sogorb10-Feb-05 22:18 
GeneralRe: DateTimePicker error debugging Pin
Steve Mayfield12-Feb-05 11:26
Steve Mayfield12-Feb-05 11:26 
GeneralRe: DateTimePicker error debugging Pin
José Luis Sogorb14-Feb-05 4:29
José Luis Sogorb14-Feb-05 4:29 
GeneralRe: DateTimePicker error debugging Pin
Steve Mayfield17-Feb-05 9:53
Steve Mayfield17-Feb-05 9:53 
GeneralRe: DateTimePicker error debugging Pin
José Luis Sogorb17-Feb-05 21:04
José Luis Sogorb17-Feb-05 21:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.