I don't typically write custom SQL queries, so please forgive the inefficiencies in the following test code. I'm trying to retrieve data from both a page type (table) and a custom table via a QueryRepeater. The following works correctly in SQL Management Studio and returns the data that I need, which is TireName, RebateType, RebateValue, and RebateDescription:SELECT DISTINCT
Tires.TireName,
Rebates.RebateType,
Rebates.RebateValue,
Rebates.RebateDescription
FROM Tire_RegionalPromotionsRebates AS Rebates
INNER JOIN TireUSConsumer2017_Tire AS Tires ON Rebates.Tires = Tires.TireName
INNER JOIN Tire_RegionalPromotionsRegions AS Regions ON Rebates.Region = Regions.Region
WHERE PostalCode = '55555'
I added this query to the custom table (Tire.RegionalPromotionsRebates) in the CMS as follows:SELECT DISTINCT
Tires.TireName,
Rebates.RebateType,
Rebates.RebateValue,
Rebates.RebateDescription
FROM Tire_RegionalPromotionsRebates AS Rebates
INNER JOIN TireUSConsumer2017_Tire AS Tires ON Rebates.Tires = Tires.TireName
INNER JOIN Tire_RegionalPromotionsRegions AS Regions ON Rebates.Region = Regions.Region
WHERE ##WHERE##
ORDER BY ##ORDERBY##
And I'm calling this with the following QueryRepeater (which I'm binding in the code-behind):@cms:CustomTableDataSource runat=@server@ ID=@RegionalPromotionsTires@ CustomTable=@Tire.RegionalPromotionsRebates@ /@
@cms:QueryRepeater runat=@server@ ID=@RegionalPromotionsTiresRepeater@ QueryName=@Tire.RegionalPromotionsRebates.RegionalRebateTires@ WhereCondition=@PostalCode='55555'@@
@ItemTemplate@
@%# Eval(@TireName@) %@
@%# Eval(@RebateType@) %@
@%# Eval(@RebateValue@) %@
@%# Eval(@RebateDescription@) %@
@/ItemTemplate@
@/cms:QueryRepeater@
I'm having two problems with this. Most notably, this throws the error 'System.Data.DataRowView' does not contain a property with the name 'TireName'. Secondarily, if I remove @TireName,@ the data (sans TireName) loads, but changing the WhereCondition does absolutely nothing. I can put numbers, letters, or anything there, or even remove it, and the QueryRepeater still returns the same values. Even hard-coding the WHERE in the custom query seemingly does nothing.Your help is most appreciated.Kentico 8.2.48
ASPX + Portal
↧