Here's a "workaround" (if that's the correct way to think of it);
protected void Page_Load(object sender, EventArgs e){
SqlDatabase sqlDatabase = new SqlDatabase("data source=(local);initial catalog=tempdb;Integrated Security = SSPI;");
DbCommand myCommand = sqlDatabase.GetStoredProcCommand("dbo.MyProc"); // CREATE PROC MyProc (@p1 DECIMAL(8,2) OUTPUT) AS SET @p1 = 8.35
// sqlDatabase.AddOutParameter(myCommand, "p1", DbType.Decimal, 10); // this returns only the number 8 and uses NUMERIC(29,0)
SqlParameter pOut = new SqlParameter("@p1", SqlDbType.Decimal);
pOut.Precision = 8;
pOut.Scale = 2;
pOut.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(pOut);
sqlDatabase.ExecuteNonQuery(myCommand);
Response.Write(sqlDatabase.GetParameterValue(myCommand, "@p1").ToString());
}
Check out http://www.LearnSqlServer.com - 20+ hours of SQL Server 2005/2000 tutorials |