Running stored procedure with ADO

To run Stored procedure, generate Proud.CAdoCommand object, fill in parameters in field of Proud.CAdoCommand.Parameters and call for Proud.CAdoCommand.Execute.

void Foo()
{
...
Proud::CAdoCommand cmd;
cmd.Prepare(conn, L"sp_GetTable1");
cmd.Parameters[1] = Val; // Refers to the first parameter of stored procedure
long retVal = cmd.Parameters[0]; // Stored procedure gains the retuned value.
if(retVal < 0)
{
...
}
else
{
if(!rs.IsOpened())
rs.Open(); // It becomes accessible only when the returned recordset object is open first.
int x = rs.FieldValues[L"FieldA"];
}
}

When any error occurs as using ADO Wrapper API, it throws Proud.AdoException type(derived class of std.exception) of exception. Following is an example of handing an exception.

void Foo()
{
try
{
...
}
{
ShowException(Proud::StringA2W(e.what())); // Converts to Unicode since e.what() returns ASCII type of string.
}
}