View Single Post
Old 25-02-2005, 04:08 PM   #6
NrmMyth
Hero Gamer

 
Join Date: Jan 2005
Location: ,
Posts: 454
Red face

Quote:
Originally posted by aaberg+Feb 23 2005, 12:55 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (aaberg @ Feb 23 2005, 12:55 PM)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin-Unknown Hero@Feb 23 2005, 12:05 AM
You can chalenge me! I'm in! k:*
Ok. Here is my challenge.

Make a function, which is able to launch any stored procedure in a database, that doesn't return any queries. :evil: The prototype is shown below.

public void executeStoredProc(string storedProcedureName, string[] parameterName, string[] parameterValue);

The prototype is only a suggestion. You are free to make your own. You may program it in whatever langauage you would like.

If it is too easy, just tell me, and I figure out something harder. :Jesus:

If I have to post the answer, it will be in C#.net [/b][/quote]
//First include your header with wanted stored proc

#include "yourheader.h"

//This is your function

void executeproc(void *procname(),char *parametername,char *parametervalue,int sizeofparameter)
{ void value,parameter;

if(sizeofparameter==sizeof(int))
{ sscanf("%d",&(int)parameter);
(int)value=parameter;
}
else if(sizeofparameter==sizeof(float))
{ sscanf("%f",&(float)parameter);
(float)value=parameter;
}
.
.
.
//And like this you check type and switch the void in needed type.

procname(value);
}

I did'n test it. So expect some errors.

I know it is not a very good procedure becouse i operates only with one parameter of that proc. you have stored.
And I don't know how to use function with unknown number of parameters (function(blah,blah,...)).

PS: I see you program in c# ,could you explain a little, difrences from ordinary c/c++.
I do c.
__________________
Never mess with me when I have a cougar, Never!
NrmMyth is offline                         Send a private message to NrmMyth
Reply With Quote