[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2004-10-15
3
Medium Priority
?
240 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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

825 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