EntLib 2.0 Problem.

EntLib 2.0 Problem.

Postby 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.
scott.pedersen
 
Posts: 21
Joined: Tue 06 Jun 2006 03:14
Location: Auckland, New Zealand

Postby 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.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby 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.
scott.pedersen
 
Posts: 21
Joined: Tue 06 Jun 2006 03:14
Location: Auckland, New Zealand

Postby Alexey » Wed 06 Sep 2006 05:52

OK, i see.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for Oracle