Hello guys, I'm having hard time to insert/create a code for one projects component. The issue is how could i call a stored procedure and how could i execute it.

Recommended Answers

All 4 Replies

Added Info:

SP: SP_RES_ss_01
-which query to a certain entry to a database

return_code = CallDBService(SP_RES_xx_03);

Here's a sample, but I don't understand.

>>Here's a sample, but I don't understand
And neither does anyone else here. That function is specific to the database library you are using, which you failed to identify. You need to read the documentation written by whoever wrote that function.

A more general way of accomplishing it is to use ODBC functions. Put the name of the stored procedure followed by all its parameters into a string and call it just like any other query, if the name of the stored procedure it Hello_World then it might look something like this -- note that string literals are in single quotes and integers are not.

char *query = "Hello_World 'param1', 'param2', intParam";

Now how to get the result set returned by the stored procedure is much more complicated, but identical to any other unbound query.

From the documentation, CallDBService was used to call a SP so from your example I would say

rc =CallDBService("SP", param1, param2, intparam);

rc would be the variable to stored the output of the SP?

rc is the value returned by CallDBService(), not the result set of the store procedure. Stored procedure result sets can have many columns and many rows of data. The rc value is probably a value that indicates whether the stored procedure was called, ran and completed successfully or not.

You will just have to read the documentation to find out correct syntax and hopefully it has a few examples too. Try to find out if whoever write those functions have a web side and user help group where you can ask questions from their experts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.