Can some help me figure out why the code below will not populate a drop down box. Thanks
//build query string
string thisSQL = "select distinct column1 from table1";
thisSQL = thisSQL + "where 0 = 0 ";
string next;
for(int i = 0; i < divList.Count; i++)
{
if (i == 0)
next = "and ";
else
next = "or ";
div = divList.ToString().Remove(3, divList.ToString().Length - 3);
sec = divList.ToString().Remove(0, divList.ToString().Length - 2);
thisSQL = thisSQL + next +"(column2 = " + div + " and column3 = " + sec + ") ";
}
//instantiate db connection
databaseConnection dbConnection = new databaseConnection();
//instantiate sql command
OracleCommand sqlCommand = new OracleCommand();
//instantiate return dataset
DataSet ds = new DataSet();
//call function to open connection and set as connection
sqlCommand.Connection = dbConnection.openDB();
//set select command text
sqlCommand.CommandText = thisSQL;
//create data adapter
OracleDataAdapter domainAdapter = new OracleDataAdapter(sqlCommand);
//close db connection
dbConnection.closeDB();
//fill dataset
domainAdapter.Fill(ds);
//set datasource
lstSubDomain.DataSource = ds;
//bind data
lstSubDomain.DataBind();
//set visible
lstSubDomain.Visible = true;
//build query string
string thisSQL = "select distinct column1 from table1";
thisSQL = thisSQL + "where 0 = 0 ";
string next;
for(int i = 0; i < divList.Count; i++)
{
if (i == 0)
next = "and ";
else
next = "or ";
div = divList.ToString().Remove(3, divList.ToString().Length - 3);
sec = divList.ToString().Remove(0, divList.ToString().Length - 2);
thisSQL = thisSQL + next +"(column2 = " + div + " and column3 = " + sec + ") ";
}
//instantiate db connection
databaseConnection dbConnection = new databaseConnection();
//instantiate sql command
OracleCommand sqlCommand = new OracleCommand();
//instantiate return dataset
DataSet ds = new DataSet();
//call function to open connection and set as connection
sqlCommand.Connection = dbConnection.openDB();
//set select command text
sqlCommand.CommandText = thisSQL;
//create data adapter
OracleDataAdapter domainAdapter = new OracleDataAdapter(sqlCommand);
//close db connection
dbConnection.closeDB();
//fill dataset
domainAdapter.Fill(ds);
//set datasource
lstSubDomain.DataSource = ds;
//bind data
lstSubDomain.DataBind();
//set visible
lstSubDomain.Visible = true;