Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2003, 08:32 AM
Authorized User
 
Join Date: Sep 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stored procedures and MFC

Hi everyone,

I spend the whole night trying to make this work, but no luck! Maybe someone can help me out. I am literally pulling hairs out of my head.

I have the following SQL Stored procedure.

CREATE PROCEDURE UpdateTestVorgaenge
 @TestName nVARCHAR(250),
 @OutID int OUTPUT

AS
 INSERT INTO Temp_TestVorgaenge_t (Name, Datum) values(@TestName, CURRENT_TIMESTAMP)
Select @OutID= @@IDENTITY

Now, I have a CRecordSet derived class and I want to use that to call this stored procedure.

here is what I do:

void DoFieldExchange(CFieldExchange* pFX)
{

        pFX->SetFieldType(CFieldExchange::param);
        RFX_Text(pFX, _T("TestName"), m_name);
        pFX->SetFieldType(CFieldExchange::inoutParam);
        RFX_Int(pFX, _T("OutID"), m_testVID);
}

And my Open statement looks like this...
CRecordset::Open(dynaset, _T("{CALL UpdateTestVorgaenge(?,?)}"), CRecordset::none);

But it throws an exception saying "Function Sequence error". Anyone has any ideas on how to make this work???

Thanks,

Sincerely yours,
Pankaj




 
Old November 4th, 2003, 12:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I don't know anything about MFC, but I do know that an INSERT statement doesn't generate a recordset, so maybe you would be better off trying to use the CCommand class to run your procedure.

Did you try a google search for "function sequence error"?
 
Old November 4th, 2003, 12:33 PM
Authorized User
 
Join Date: Sep 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah,

I did a search but did not come up with anything useful. I gave up on the problem though...Just gonna use ExecuteSQL from the CDatabase class and use SQLBindparam manually.

Thanks :-)

Pankaj






Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedures MunishBhatia SQL Server 2005 4 April 12th, 2008 01:39 AM
Stored Procedures help psnow1985 SQL Server 2005 2 April 12th, 2008 01:31 AM
stored procedures thillaiarasu ASP.NET 2.0 Basics 2 May 3rd, 2007 07:55 AM
Stored Procedures jazzcatone Classic ASP Databases 0 August 28th, 2005 02:57 PM
Stored Procedures stu9820 Access 3 February 8th, 2004 01:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.