Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

Enterprise Library 2.0 Data Access Application Block


Could someone tell me how to run a simple SQL stored procedure using
the Enterprise Library 2.0 Data Access?

I have in my VB.NET code the following database:
      Dim db As Database = DatabaseFactory.CreateDatabase


You need to define whether or not the stored procedure returns rows or not.

"shapper" <mdmo@gmail.com> wrote in message


From memory:

                Dim dbCommandWrapper As DatabaseCommandWrapper =

                dbCommandWrapper.AddInParameter("@EmpID", DbType.Int,
12345 )

                ' Output parameters specify the size of the return data
DbType.Int32, 0)

                Dim rowsAffected As Int32
                rowsAffected = db.ExecuteNonQuery(dbCommand)

' there are diffferent methods. ExcecuteReader, LoadDataSet.. you have to
match yours to what you want it to do


Ahh, sorry, I gave you a 1.1 example:

Here is 2.0

        private Microsoft.Practices.EnterpriseLibrary.Data.Database

            // Create the Database object, using the default database
service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            return db;

private void UpdateEmployeeData(int empid )

            Database db = this.GetDatabase();

            DbCommand dbc = db.GetStoredProcCommand("dbo.uspSomeProcedure);

            db.AddInParameter(dbc , "@EmpID", DbType.Int32, empid);

            db.AddOutParameter(dbc , "@numberRowsAffected", DbType.Int32,

db.ExecuteNonQuery(dbc )

"sloan" <s@ipass.net> wrote in message


Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc