sql server - ComboBox Shows System.Data.DataRow (MVC) -


My combibox does not show values ​​in my SQL-attribute "Timeblocks", instead it shows the system. Data.DataRow 5 times. What's wrong with my code?

Code:

  // entered: public class DAL {string ConnectionString = "server = ICSSQL13 \\ group 28,1528; Trustedconconction = Ha; database = yoloswag "; Public Datatare Store SQLDataIncombobox () {SQL Connection Connection = New SQL Connection (Connection String); Conn.Open (); String StoreSqlDataInComboBoxTP = "Select Timeblocks from TimePerfect Group by Time Block"; SqlCommand CMD = New SqlCommand (StoreSqlDataInComboBoxTP, Conn); SqlDataAdapter Adapter = New SqlDataAdapter (CMD); Dataset DST = New Dataset (); Adapter.Fill (DSet); Adapter.Dispose (); Cmd.Dispose (); Conn.Close (); Conn.Close (); Returns DSet.Tables [0]; }} // Controller: Public Sector Controller {DAL Group = New DAL (); Public DataTable StoresClatinecombobox () {Return Team Store Claddetincombbox (); }} // View: Public Partial Class Booking: Form {Admin Controller = New Controller (); Datatable dtb = new datatable (); Dataset DST = New Dataset (); // Ignore String Username Public Booking (String Username) {DTable = controller.storesqldataincomboboxtp (); If (dtb.racount> gt; 0) {for (int i = 0; i & lt; dtables everyday); i ++) {CBTime.Items.Add (DTable.Rows [i]. Ostring ()); }}}}  

5 Instead of System.Data.DataRow, I want to show what is stored in "TimeBlock", "Select Timeblocks from Timeblocks by Timeblocks": "08-00 - 10:00 "" 10:00 - 12:00 "" 12:00 - 14:00 "" 14:00 - 16:00 "" 16: 00 - 18:00 "

I How can I solve it?

Thanks

When you call add on CBM, you Not reaching the field level, in the lines of your table, it will do something that the rows of your table will work:

  foreach (DataRow dRow in DTable.Rows) {CBTime.Items.Add (DRow ["TimeBlock"]); }  

Comments