Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Binding parameter CRecordset

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-12-21 : 08:03:56
Rolf writes "Hey,

I've a problem with a Stored Procedure:

------------------------------------
ALTER PROCEDURE dbo.Number
(
@parameter1 int = 0
)
AS
SELECT *
FROM Table
WHERE Number = @parameter1
/* SET NOCOUNT ON */
RETURN
------------------------------------

In my C++ class I call this Stored Procedure by:
------------------------------------
CString number = L"5";
CRecordset record(&database);
record.Open(CRecordset::dynamic,_T("{CALL Number(" + number + L")}"),CRecordset::readOnly);
------------------------------------

The problem is that 'number' isn't a CString but a integer.
(int number = 5;)
It's not allowed to change the integer into CString. How can I bind the integer with the stored procedure?

Thnx,
Rolf"

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-21 : 08:39:50
You concatenate the C++ string with something like

record.Open(CRecordset::dynamic,_T("{CALL Number(" + number.tostring() + L")}"),CRecordset::readOnly);


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -