EntLib 2.0 Problem.

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
scott.pedersen
Posts: 21
Joined: Tue 06 Jun 2006 03:14
Location: Auckland, New Zealand

EntLib 2.0 Problem.

Post by scott.pedersen » Tue 05 Sep 2006 04:07

Hi,

I have the following code that is used to populate a listbox, and works fine -

Database database = DatabaseFactory.CreateDatabase(Resources.Database);
string sqlCommand = "Select Site_Name, Site_Code From Risk_Management_Database.Rmd_Sites_Vw";

DbCommand dbCommand = database.GetSqlStringCommand(sqlCommand);
DataSet dataSet = new DataSet();
database.LoadDataSet(dbCommand, dataSet, "Rmd_Sites_Vw");

site.DisplayMember = "Site_Name";
site.ValueMember = "Site_Code";
site.DataSource = dataSet.Tables["Rmd_Sites_Vw"]

Now I want to return rows that only meet a particular company group, so I have changed the code to the following -
Database database = DatabaseFactory.CreateDatabase(Resources.Database);
string sqlCommand = "Select Site_Name, Site_Code From Risk_Management_Database.Rmd_Sites_Vw Where Company = :CompanyGroup";

DbCommand dbCommand = database.GetSqlStringCommand(sqlCommand);
database.AddInParameter(dbCommand, "CompanyGroup", DbType.String, companyGroup);
DataSet dataSet = new DataSet();
database.LoadDataSet(dbCommand, dataSet, "Rmd_Sites_Vw");

site.DisplayMember = "Site_Name";
site.ValueMember = "Site_Code";
site.DataSource = dataSet.Tables["Rmd_Sites_Vw"];

Now no rows are returned. I can trace the execution and no errors seem to occur, I just don't think the sql command is using the parameter value to filter the result set.

Any help on this issue would be appreciated.

Cheers,

Scott.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 05 Sep 2006 08:22

Please send us your project to reproduce the problem. It is desirable to use 'scott' schema objects, otherwise include definition of your own database objects. Do not use third party components. Use e-mail address provided in the Readme file.
Last edited by Alexey on Mon 27 Nov 2006 08:23, edited 1 time in total.

scott.pedersen
Posts: 21
Joined: Tue 06 Jun 2006 03:14
Location: Auckland, New Zealand

Post by scott.pedersen » Wed 06 Sep 2006 01:46

Hi,

I have fixed the problem. It wasn't anything to do with the AddInParameter method.

Cheers,

Scott.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 06 Sep 2006 05:52

OK, i see.

Post Reply