?
Solved

Calling Stored procedure from C++ or calling VB COM from C++

Posted on 2004-10-15
3
Medium Priority
?
233 Views
Last Modified: 2010-05-18
Hi,

I am basically a VB programmer and I now have a task to write a C++ dll which will invoke a Stored procedure in MSQL server.

The SP takes username, ID, AFlag and Output message.

Assuming I am using the VC++ process for the first time can you provide me a code sample step by step.

I can easily write this in VB COM. Is it easy to call the COM compnent than writing this in VC++ (are there any disadvantages?)

Also all the input parameters Should be passed to the VC++ dll as a singel parameter with a ',' delimiter. I hope you will also tell how to parse.

500 points for a quick turn around with code samples

Thanks
0
Comment
Question by:praveen_ms
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1500 total points
ID: 12321467
If you cann use MFC, you'll like the idea that there's even a class wizard for that task: http://www.codeproject.com/database/spcw.asp
0
 
LVL 2

Author Comment

by:praveen_ms
ID: 12321498
I need to create a win32 DLL

I have in stdAfx.h

struct XMLDataBuf
{
// enum XMLCharSet      charSet; //for Siebel v6.x/v7.0.x only (CR#12-E7SHOB)
   int                  nLength;
   void*                pData;
};

extern "C" int __declspec(dllexport) TestEAI(const XMLDataBuf* Value, XMLDataBuf* pReply);

and in my cpp
extern "C" int __declspec(dllexport) MyFunctionName( const XMLDataBuf* Value, XMLDataBuf* pReply)

So Now I need to parse const XMLDataBuf* Value that for ',' and call SP.

Thanks

0
 
LVL 2

Author Comment

by:praveen_ms
ID: 12321578
and in my cpp
extern "C" int __declspec(dllexport) MyFunctionName( const XMLDataBuf* Value, XMLDataBuf* pReply)

Should have been
and in my cpp
extern "C" int __declspec(dllexport) TestEAI( const XMLDataBuf* Value, XMLDataBuf* pReply)
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question