I am trying to bind a DropDownList  to a sqlDataReader. I get the
correct amount of options in the list, but the text is
'System.Data.Common.DbDataRecord' for all the options in the list. What
am I doing wrong?
 
      private void Page_Load(object sender, System.EventArgs e)
      {
      
            // connect to database
            SqlConnection SqlConn = new SqlConnection(connStr);
            SqlConn.Open();
            // get data
            string SQL = "SELECT pub_id,pub_name FROM publishers ORDER
BY pub_name";
            SqlCommand sqlCommand1 = new SqlCommand(SQL,SqlConn);
            SqlDataReader reader = sqlCommand1.ExecuteReader();
            // do binding
            DropDownList1.DataSource = reader;
            DropDownList1.DataBind();
      }

______________________________________________

"This information is intended only for the person or entity to which it is addressed 
and
may contain private, confidential, proprietary and/or privileged material and may be 
subject
to confidentiality agreements.

Any review, retransmission, dissemination, or any other use of or taking of any action 
in
reliance upon this information, by persons or entities other than the intended 
recipient,
is prohibited.

If you received this in error, please contact the sender and delete the material from 
all
storage media.

The company is neither liable for proper, complete transmission of the information 
contained
in this communication, any delay in its receipt or that the mail is virus-free"

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to