Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox "System.Data.DataRowView" for all values 1

Status
Not open for further replies.

kermitforney

Technical User
Mar 15, 2005
374
0
0
US
Let me preface this post by explaining that I am VERY new to .Net and usually have my head stuck up SQL Server Management Studio.

I am trying to modify a combobox so that it displays the values returned from a stored procedure. Seems pretty simple, but when Debugging, the only values that are displayed are the "System.Data.DataRowView" for every value returned.

Somehow I am not assigning the value correctly, just not sure how.

Code:
cmd.CommandText = "stpRecruiters"
                cmd.Parameters.Clear()
                dtr = cmd.ExecuteReader()
                dtb.Clear()
                dtb.Columns.Add(New DataColumn("strAssignedRecruiter", GetType(String)))

                While dtr.Read
                    drw = dtb.NewRow
                    drw("strAssignedRecruiter") = dtr("strAssignedRecruiter")
                    dtb.Rows.Add(drw)
                End While

                cboRecruiter.DataSource = dtb
                cboRecruiter.DataBind()
                dtr.Close()
 
There are 2 properties on the combobox you need to set.

DataTextField
DataValueField

I am not sure those are the exact names, but you will find them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top