EN-DAAB -- DbCommandWrapper not defined?

K

K B

Hi, I'm using the Enterprise Data Access Application Block.
I've imported the Data and Data.SQL dlls.

With the following code block, I get an error that "Type
DbCommandWrapper is not defined." I can't find an answer...all examples
I've seen use this.

Dim db As Database = DatabaseFactory.CreateDatabase()
Dim cmd As dbcommandwrapper = db.GetStoredProcCommandWrapper("GetUser")
cmd.AddInParameter("@UserName", DbType.String, sUser)
Dim ds As DataSet = db.ExecuteDataSet(cmd)

Please Help!
Thanks,
Kit
 
K

K B

Still have a problem, although I found dbCommandWrapper has been
deprecated. From references, it says I should be using:

Dim cmd As dbCommand = db.GetStoredProcCommand("GetUser")

I still get the "Type dbCommand not defined" error, and dbCommand does
not show up in intellisense.

Please help...this is really holding me up.

Thanks,
Kit
 
S

sloan

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Globalization;
using System.Xml;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace MyCompany.MyApp.Data.UserLib
{
public class UserData
{

private readonly string PROC_USERINFO_GET_SINGLE =
"dbo.uspUserInfoGetSingleByID";



public UserData()
{

}



private Microsoft.Practices.EnterpriseLibrary.Data.Database
GetDatabase()
{


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

return db;
}





public IDataReader UserDataReaderSingleGetByID(string uuid)
{

Database db = this.GetDatabase();

string sqlCommand = PROC_USERINFO_GET_SINGLE;
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

// Retrieve products from the specified category.
db.AddInParameter(dbCommand, "userUUID", DbType.String,
uuid);

return db.ExecuteReader(dbCommand);


}



public DataSet UserDataDSSingleGetByID(string uuid)
{

Database db = this.GetDatabase();

string sqlCommand = PROC_USERINFO_GET_SINGLE;
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

// Retrieve products from the specified category.
db.AddInParameter(dbCommand, "userUUID", DbType.String ,
uuid);

DataSet ds = new DataSet();

db.LoadDataSet(dbCommand, ds, new string[] { "mytable1"
});

// Note: connection was closed by ExecuteDataSet method
call

return ds;

}


}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,112
Latest member
VinayKumar Nevatia
Top