Populating a dropdown listbox problem!
dmlegare <[email protected]> Wed, 19 Jun 2002 07:00:19 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.general |
|---|---|
| Message-ID | <[email protected]> |
How do I use my datareader object to populate a dropdownlistbox??? Im
getting conversion type errors..??????
here is the code
string myConnection = "........";
string mySelectQuery = "select employee_class_name from onlinetime_empclass
";
OleDbConnection myConn = new OleDbConnection(myConnection);
OleDbCommand objCommand = new OleDbCommand(mySelectQuery, myConn);
OleDbDataReader objDataReader = null;
myConn.Open();
objDataReader = objCommand.ExecuteReader();
string sEmployClass = "";
while (objDataReader.Read() == true)
{
*sEmployClass = objDataReader["employee_class_name"];
ddemployeeClassification.Items.Add(sEmployClass);
}
I get an error when i try to view in a browsers:
*Compiler Error Message: CS0029: Cannot implicitly convert type 'object' to
'string'
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.