Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem in DataTable

Problem in DataTable

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohamed Ishak
    wrote on last edited by
    #1

    :)In .Net When you Load the Recordset to datatable.If you set source of data to controls like listbox or combobox some times the datas are not viewed instead of In control we see the form of System.Data.DataRowView(It happenes only in sometime not all time )but we can avoid it through dataview For example dim dt as datatable Adapter.Fill(dt) ComboBox.Datasource = dt ComboBox.DisplayMember="Column1" ComboBox.ValueMember = "Column2" // In my case Display member displays record well but problem in Valuemember only i got as system.Data.DataRowView you can avoid this in DirectCasting of DatarowView Otherwise dim dv as dataview = dt.DefaultView ComboBox.Datasource = dv ComboBox.DisplayMember="Column1" ComboBox.ValueMember = "Column2" // Now works fine Otherwise you can directly give as ComboBox.Datasource = dt.Defaultview ComboBox.DisplayMember="Column1" ComboBox.ValueMember = "Column2" // Now works fine I dont know why its happened,If anybody knows ,Let inform here Rugfy Rugfy

    R 1 Reply Last reply
    0
    • M Mohamed Ishak

      :)In .Net When you Load the Recordset to datatable.If you set source of data to controls like listbox or combobox some times the datas are not viewed instead of In control we see the form of System.Data.DataRowView(It happenes only in sometime not all time )but we can avoid it through dataview For example dim dt as datatable Adapter.Fill(dt) ComboBox.Datasource = dt ComboBox.DisplayMember="Column1" ComboBox.ValueMember = "Column2" // In my case Display member displays record well but problem in Valuemember only i got as system.Data.DataRowView you can avoid this in DirectCasting of DatarowView Otherwise dim dv as dataview = dt.DefaultView ComboBox.Datasource = dv ComboBox.DisplayMember="Column1" ComboBox.ValueMember = "Column2" // Now works fine Otherwise you can directly give as ComboBox.Datasource = dt.Defaultview ComboBox.DisplayMember="Column1" ComboBox.ValueMember = "Column2" // Now works fine I dont know why its happened,If anybody knows ,Let inform here Rugfy Rugfy

      R Offline
      R Offline
      Ritesh1234
      wrote on last edited by
      #2

      Hi, Check whether ur Column name "Column2" is exactly same as that ur fetching from Databse(I mean check for case sensitivity) Regards, Ritesh

      M 1 Reply Last reply
      0
      • R Ritesh1234

        Hi, Check whether ur Column name "Column2" is exactly same as that ur fetching from Databse(I mean check for case sensitivity) Regards, Ritesh

        M Offline
        M Offline
        Mohamed Ishak
        wrote on last edited by
        #3

        :^)Hai, No ritesh,I have checked thats not the problem,I have given details follws Desc Of my Table in DataBase Name Null? Type ----------------------------------------- -------- ------------- OWNERSHIPTYPEID NOT NULL NUMBER DESCRIPTION NOT NULL VARCHAR2(50) MySql Satament cmdLocal = New OracleClient.OracleCommand("SELECT OWNERSHIPTYPEID,DESCRIPTION FROM OWNERSHIPTYPE", Me.conLocal) My Property Binding Of Control Me.DataSource = dtLocal //DataTable Me.DisplayMember = "DESCRIPTION" Me.ValueMember = "OWNERSHIPTYPEID" This code has given problem,But in another cmbobox like this for another table works fine Rugfy

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups