ADO.NET

Return value parameter returns null

Tuesday, August 29th, 2006
I was really confused this morning. I was executing a stored proc that returned a single row of data, and a return value. However, the return value was always null - even though the stored proc ALWAYS returned a return value. The code was domething like this: PLAIN TEXT C#: SqlParameter retval = new SqlParameter("@RETURN_VALUE", SqlDbType.Int); retval.Direction = ParameterDirection.ReturnValue; command1.Parameters.Add(retval);   using ... read more

Enterprise Library Data Access and Stored Procedure Synonyms

Wednesday, August 23rd, 2006
The Enterprise Library Data Access application block offers some time-saving routines for calling stored procedures. However, they don't all work when the stored procedure is a synonym. For example, once I have a Database object, I can get a DataReader from a stored proc called GetUser by simply calling: PLAIN TEXT C#: Database db = DatabaseFactory.CreateDatabase(); IDataReader reader = db.ExecuteReader("GetUser", ... read more