Solved

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

Posted on 2004-10-15
3
212 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 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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.

785 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