Hi,
I'm trying to create a generic function to call stored procedures in a
SQL Server database.
I'm passing the params, values and the direction of the params in
arrays.
The function is working, and I get the output parameters values back in
my the array I sent, however, I'd like to have the values in my
original variables, please see below :
int ID = 0;
string[] Params = {"@USER_USERID", "@USER_ID"};
object[] Directions = {ParameterDirection.Input,
ParameterDirection.Output };
object[] Values = {UserID, ID};
DbSQLServer.ExecuteScalarStored("clsd_GetUserID",
Params, Directions, ref Values);
Console.WriteLine(ID);
at the end of this run the value of ID is zero. But the value of
"Values[1]" (the second) has the returning value of my function.
What I want here, is to be able to fill the original variables
directly, I mean, to put the values in "UserID" and "ID".
I could to this easly with pointers, but without them I feel like hands
tied.
Is this possible ? Or am I just looking for something that can't be
done.
Any recommendation is welcome.