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. Web Development
  3. ASP.NET
  4. dataview

dataview

Scheduled Pinned Locked Moved ASP.NET
csharpdesignhelp
2 Posts 1 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.
  • B Offline
    B Offline
    bigtone78
    wrote on last edited by
    #1

    I am trying to set a data relation and I keep getting an error saying: The relation is not parented to the table to which this DataView points. What does this mean. Here is the vb.net code that im using: <%@ Import Namespace="System.Data.Odbc" %> <%@ Import Namespace="System.Data" %> sub Page_Load Dim sConnString As String = "Dsn=mysqldb;" & _ "Uid=bigtone78;" & _ "Pwd=" Dim oODBCConnection As New OdbcConnection(sConnString) Dim myInsertQuery As String = "SELECT * FROM questions" Dim cmd1 As odbcdataAdapter = New odbcdataAdapter(myInsertQuery, oODBCConnection) Dim ds As DataSet = New DataSet() cmd1.Fill(ds, "questions") Dim sqlQuery as String = "select * from options" Dim cmd2 As odbcdataAdapter = New odbcdataAdapter(sqlQuery, oODBCConnection) cmd2.Fill(ds, "options") ds.Relations.Add(new DataRelation("myrelation", ds.Tables("questions").Columns("id"), ds.Tables("options").Columns("qID"))) questions.DataSource= ds.Tables("questions") questions.DataBind() oODBCConnection.close() end sub sub questions_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) if e.item.itemtype = ListItemType.Item or e.item.ItemType = ListItemType.AlternatingItem then Dim dv as DataRowView = e.Item.DataItem if not dv is nothing then Dim nestedRepeater as Repeater = e.item.FindControl("opts") if Not nestedrepeater Is Nothing then nestedRepeater.DataSource = dv.CreateChildView("options") nestedRepeater.DataBind() end if end if end if response.write("<br />") end sub

    B 1 Reply Last reply
    0
    • B bigtone78

      I am trying to set a data relation and I keep getting an error saying: The relation is not parented to the table to which this DataView points. What does this mean. Here is the vb.net code that im using: <%@ Import Namespace="System.Data.Odbc" %> <%@ Import Namespace="System.Data" %> sub Page_Load Dim sConnString As String = "Dsn=mysqldb;" & _ "Uid=bigtone78;" & _ "Pwd=" Dim oODBCConnection As New OdbcConnection(sConnString) Dim myInsertQuery As String = "SELECT * FROM questions" Dim cmd1 As odbcdataAdapter = New odbcdataAdapter(myInsertQuery, oODBCConnection) Dim ds As DataSet = New DataSet() cmd1.Fill(ds, "questions") Dim sqlQuery as String = "select * from options" Dim cmd2 As odbcdataAdapter = New odbcdataAdapter(sqlQuery, oODBCConnection) cmd2.Fill(ds, "options") ds.Relations.Add(new DataRelation("myrelation", ds.Tables("questions").Columns("id"), ds.Tables("options").Columns("qID"))) questions.DataSource= ds.Tables("questions") questions.DataBind() oODBCConnection.close() end sub sub questions_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) if e.item.itemtype = ListItemType.Item or e.item.ItemType = ListItemType.AlternatingItem then Dim dv as DataRowView = e.Item.DataItem if not dv is nothing then Dim nestedRepeater as Repeater = e.item.FindControl("opts") if Not nestedrepeater Is Nothing then nestedRepeater.DataSource = dv.CreateChildView("options") nestedRepeater.DataBind() end if end if end if response.write("<br />") end sub

      B Offline
      B Offline
      bigtone78
      wrote on last edited by
      #2

      Nevermind I figured out this problem but it still doesnt work. The data still doesnt appear in the nested repeater.

      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