Ramco Ramco

Ramco Ramco

  • 442
  • 3.4k
  • 528.5k

Error - System.Data.DataRowView

Sep 1 2024 11:19 AM

Hi

  I have below data . In Dropdown it is showing System.Data.DataRowView

private void GetLocation()
        {
            try
            {
                con.ConnectionString = ConfigurationManager.ConnectionStrings["cnn_Live"].ConnectionString; ;
                SqlCommand cmd = new SqlCommand("select docentry,locationname from Location", con);
                cmd.CommandType = CommandType.Text;
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                SqlDataAdapter sda = new SqlDataAdapter(cmd);

                DataTable dt = new DataTable();
                sda.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    ddlLocation.DataSource = dt;
                    ddlLocation.DataBind();
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                ShowMessage("", ex.Message, "error");
            }
        }

Thanks


Answers (1)