By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

Nested Repeater Control

P: 5
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
End Using
End Using (for con)

Thanks all for your help!
Apr 25 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 638
Not knowing how your database is set up, I would suggest removing the Project.* and replacing it with just *. Seems like its having an issue with that prefix
Apr 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.