DataBind Problem???

Results 1 to 2 of 2

Thread: DataBind Problem???

  1. #1
    Join Date
    Dec 1969

    Default DataBind Problem???

    I am binding a data to a drop down using the following code<BR><BR>pubs_id.DataSource = admin.GetFewPubs(region_id, "1")<BR>pubs_id.Items.Insert(0, new ListItem("Select a Vehicle"))<BR>pubs_id.DataBind()<BR><BR>But it gives me this error<BR>"Invalid attempt to FieldCount when reader is closed"<BR><BR>But when I Remove<BR><BR>pubs_id.DataBind<BR><BR>It works fine. Although The second line...<BR><BR>pubs_id.Items.Insert(0, new ListItem("Select a Vehicle")), will not work then. Any idea why?<BR><BR>Thanx

  2. #2
    Join Date
    Dec 1969

    Default RE: DataBind Problem???

    A couple of thoughts, dont add your "Select A Vechile" in until you bind your data. I&#039;ve never seen a datasouce with the syntax you are using but the error message is basically saying you need to do a .READ command to open the reader, this will however take the first element out of the reader and mess you your binding. If you post what the heck admin.GetFewPubs is refering to I might be able to help more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts