473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

CRecordset + char + stored procedures inoutParam

GS
Hi

Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05 Copyright (c) 1988-2003
Microsoft Corporation Desktop Engine on Windows NT 5.1 (Build 2600: Dodatek
Service Pack. 1)

and MDAC2.8, VC7
--------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[OutputParams]
@InputParam char(20) ,
@OutputParam char(20) = '' OUTPUT
As
SELECT @OutputParam = @InputParam
RETURN 19
GO
--------------------------------------------------------------------------
StoredProcedure :: CRecordset()

void StoredProcedure::DoFieldExchange(CFieldExchange* pFX)
{
//{{AFX_FIELD_MAP(StoredProcedure)
//}}AFX_FIELD_MAP

pFX->SetFieldType(CFieldExchange::outputParam);
RFX_Long(pFX, "RETURN_VALUE", m_retRETURN_VALUE);
pFX->SetFieldType(CFieldExchange::inputParam);
RFX_Text(pFX, "InputParam", m_paramInputParam,255);
pFX->SetFieldType(CFieldExchange::inoutParam);

RFX_Text(pFX, "OutputParam", m_paramOutputParam,255);
//or RFX_TextOut(pFX, "OutputParam", m_paramOutputParam,255,SQL_CHAR,0);
//http://www.codeguru.com/Cpp/data/mfc_database/storedprocedures/article.php
/c1167/
}
--------------------------------------------------------------------------

db.Open(NULL, FALSE, FALSE, _T(csDSN));
StoredProcedure rs(&db);
rs.m_paramInputParam="nyiuy";
rs.m_paramOutputParam="";
rs.m_retRETURN_VALUE=0;

rs.Open(CRecordset::forwardOnly, _T("{? = CALL OutputParams(?,?)}"),
CRecordset::readOnly);
while( rs.FlushResultSet())
{
while (!rs.IsEOF())
{
rs.MoveNext();
}
}

CString s2,s1;
s1.Format("str=%i : ",rs.m_retRETURN_VALUE); // Display the output parameter
value
s2 = rs.m_paramOutputParam;

AfxMessageBox(s1+":"+s2);

--------------------------------------------------------------------------
Show "19:" s2=NULL whay?

if
@OutputParam char(20) = '' OUTPUT ---> @OutputParam int = 0 OUTPUT
is work
else does't work

plz help??

Jul 23 '05 #1
0 1268

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures...
2
by: scott | last post by:
Hi, Just wondering what sort of problems and advantages people have found using stored procedures. I have an app developed in VB6 & VB.NET and our developers are starting to re-write some of the...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
2
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
1
by: Mike C# | last post by:
Hi all, I'm writing a little app that uses ODBC to call a SQL 2K stored procedure several times in a loop, with a different parameter each time. The SP can return no results in some instances. ...
11
by: peter | last post by:
I am trying to get a SQL stored procedure to use user maintained MQT implicitly which raises questions on when they are used or not used. In theory you would expect the stored procedure to pick up...
2
by: E11esar | last post by:
Hi there. I am writing a web service in C# that connects to an Oracle database via OleDb and wish for the service to return a dataset for use by a client application. I have achieved this using...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.