hi,
how do I get output parameters from sql 2005 query using the entlib 2,0?
I noticed the dbcommandwrapper is not there anymore.

thanks
xisco

Re: how to get output parameters using enterprise library 2.0 by Triax

Triax
Wed Feb 01 20:40:07 CST 2006

DBCommandWrapper has been deprecated. The parameter functions are off the
Database class now. Here's some code from the QuickStart.

public string GetProductDetails(int productID)
{
// Create the Database object, using the default database
service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();

string sqlCommand = "GetProductDetails";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

// Add paramters
// Input parameters can specify the input value
db.AddInParameter(dbCommand, "ProductID", DbType.Int32,
productID);
// Output parameters specify the size of the return data
db.AddOutParameter(dbCommand, "ProductName", DbType.String, 50);
db.AddOutParameter(dbCommand, "UnitPrice", DbType.Currency, 8);

db.ExecuteNonQuery(dbCommand);

// Row of data is captured via output parameters
string results = string.Format(CultureInfo.CurrentCulture, "{0},
{1}, {2:C} ",
db.GetParameterValue(dbCommand,
"ProductID"),
db.GetParameterValue(dbCommand, "ProductName"),
db.GetParameterValue(dbCommand, "UnitPrice"));

return results;
}

HTH

___________________________
Triax


"xisco" <xisco@hotmail.com> wrote in message
news:uXZu0BuJGHA.2248@TK2MSFTNGP15.phx.gbl...
> hi,
> how do I get output parameters from sql 2005 query using the entlib 2,0?
> I noticed the dbcommandwrapper is not there anymore.
>
> thanks
> xisco
>



Re: how to get output parameters using enterprise library 2.0 by xisco

xisco
Wed Feb 01 21:09:36 CST 2006

Great. thanks!


"Triax" <noreply@noreply.com> wrote in message
news:%232oi7H6JGHA.2392@TK2MSFTNGP09.phx.gbl...
> DBCommandWrapper has been deprecated. The parameter functions are off the
> Database class now. Here's some code from the QuickStart.
>
> public string GetProductDetails(int productID)
> {
> // Create the Database object, using the default database
> service. The
> // default database service is determined through
> configuration.
> Database db = DatabaseFactory.CreateDatabase();
>
> string sqlCommand = "GetProductDetails";
> DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
>
> // Add paramters
> // Input parameters can specify the input value
> db.AddInParameter(dbCommand, "ProductID", DbType.Int32,
> productID);
> // Output parameters specify the size of the return data
> db.AddOutParameter(dbCommand, "ProductName", DbType.String, 50);
> db.AddOutParameter(dbCommand, "UnitPrice", DbType.Currency, 8);
>
> db.ExecuteNonQuery(dbCommand);
>
> // Row of data is captured via output parameters
> string results = string.Format(CultureInfo.CurrentCulture,
> "{0}, {1}, {2:C} ",
> db.GetParameterValue(dbCommand,
> "ProductID"),
> db.GetParameterValue(dbCommand, "ProductName"),
> db.GetParameterValue(dbCommand, "UnitPrice"));
>
> return results;
> }
>
> HTH
>
> ___________________________
> Triax
>
>
> "xisco" <xisco@hotmail.com> wrote in message
> news:uXZu0BuJGHA.2248@TK2MSFTNGP15.phx.gbl...
>> hi,
>> how do I get output parameters from sql 2005 query using the entlib 2,0?
>> I noticed the dbcommandwrapper is not there anymore.
>>
>> thanks
>> xisco
>>
>
>