Hello All,
I am new to this so I apologize if this question has been asked before. I am working on nesting two data repeaters. The parent repeater displays Categories, and the child repeater displays the projects for each category as thumbnails.
I am having a hard time binding the data of the child repeater. When I compile, it says: "The column prefix 'Project' does not match with a table name or alias name used in the query"
Here is the code:
Dim MyQuery As New System.Text.StringBuilder
MyQuery.AppendLine("SELECT CategoryName ")
MyQuery.AppendLine("FROM Category ")
MyQuery.AppendLine("WHERE (Enabled = 1) ")
Using MyCommand As New SqlCommand(MyQuery.ToString, MyConnection)
Dim MyDataSet As New DataSet
Dim MyDataAdapter As New SqlDataAdapter(MyCommand)
MyDataAdapter.Fill(MyDataSet, "CategoryName")
End Using
Dim MyQuery2 As New System.Text.StringBuilder
MyQuery2.AppendLine("SELECT Project.*, Category.Id ")
MyQuery2.AppendLine("FROM Project, Category ")
MyQuery2.AppendLine("LEFT OUTER JOIN ProjectCategories AS ProjectID ON Project.Id = ProjectID.ProjectId ")
MyQuery2.AppendLine("LEFT OUTER JOIN ProjectCategories AS CategoryID ON Category.Id = CategoryID.CategoryId ")
MyQuery2.AppendLine("WHERE (Project.Enabled = 1) ")
Using MyCommand2 As New SqlCommand(MyQuery2.ToString, MyConnection)
Dim MyDataSet As New DataSet
Dim MyDataAdapter As New SqlDataAdapter(MyCommand2)
MyDataAdapter.Fill(MyDataSet, "ProjectThumbnailURL")
'Dim MyDataView As New DataView(MyDataSet.Table("CategoryName"))
MyDataSet.Relations.Add("MyRelation", MyDataSet.Tables("Category").Columns("Id"), MyDataSet.Tables("Project").Columns("Id"))
rptCategories.DataSource = MyDataSet
rptCategories.DataBind()
End Using
End Using (for con)
Thanks all for your help!