Technical support This forum is closed.
Version 1.x > Technical support > CMSForm View modes: 
User avatar
Member
Member
JeremyThake - 2/21/2006 7:33:29 AM
   
CMSForm
I'm getting this error

"Column 'COM_ProductName' does not belong to table Table1. "


when I try to add a new item of CMS type 'Product'.

I've tweaked the query.config file to allow the select and selectByPath to have access to the joined COM_Product table.
I'm using the cmsdatalist using two transformations that both use CONTENT_Product and COM_Product information.

What do I have to do to get round this? Something the CMSForm object is doing is preventing it from adding a product and for some reason is searching for COM_ProductName on inserting it!


<queries>
<query id="select" type="querytext" transaction="false">SELECT *, dbo.COM_Product.ProductName AS COM_ProductName
FROM view_cms_tree_joined
INNER JOIN [CONTENT_Product] ON [CONTENT_Product].[ProductID] = view_cms_tree_joined.foreignkeyvalue
INNER JOIN dbo.COM_Product ON dbo.COM_Product.ProductID = view_cms_tree_joined.comproductid
WHERE classname = 'CMS.Product' AND CONTENT_Product.productID = @ID </query>
<query id="insert" transaction="true" type="query">INSERT INTO [CONTENT_Product] ( [ProductDescription], [ProductPhoto], [FeaturedProduct] , ShippingPrice_AUS, ShippingPrice_PACIFIC, ShippingPrice_OVERSEAS, ProductPrice_Member, ProductPrice_NonMember) VALUES ( @ProductDescription, @ProductPhoto, @FeaturedProduct, @ShippingPrice_AUS, @ShippingPrice_PACIFIC, @ShippingPrice_OVERSEAS, @ProductPrice_Member, @ProductPrice_NonMember); SELECT @@identity AS [ProductID] </query>
<query id="update" type="query" transaction="false">UPDATE [CONTENT_Product] SET [ProductDescription] = @ProductDescription, [ProductPhoto] = @ProductPhoto, [FeaturedProduct] = @FeaturedProduct, ShippingPrice_AUS = @ShippingPrice_AUS, ShippingPrice_PACIFIC = @ShippingPrice_PACIFIC, ShippingPrice_OVERSEAS = @ShippingPrice_OVERSEAS, ProductPrice_Member = @ProductPrice_Member, ProductPrice_NonMember = @ProductPrice_NonMember WHERE [ProductID] = @ProductID</query>
<query id="delete" type="query" transaction="false">DELETE FROM [CONTENT_Product] WHERE [ProductID] = @ID</query>
<query id="selectbypath" type="querytext" transaction="false">SELECT view_cms_tree_joined.*, [CONTENT_Product].*
, dbo.COM_Product.ProductName AS COM_ProductName
, dbo.COM_Product.ProductPrice AS COM_ProductPrice
FROM view_cms_tree_joined
INNER JOIN [CONTENT_Product] ON [CONTENT_Product].[ProductID] = view_cms_tree_joined.foreignkeyvalue
INNER JOIN dbo.COM_Product ON dbo.COM_Product.ProductID = view_cms_tree_joined.comproductid
WHERE (##WHERE##) AND classname = 'CMS.Product'
ORDER BY ##ORDERBY## </query>
<query id="searchtree" type="query" transaction="false">SELECT view_cms_tree_joined.*, view_cms_tree_joined.NodeName AS SearchResultName FROM view_cms_tree_joined INNER JOIN [CONTENT_Product] ON [CONTENT_Product].[ProductID] = view_cms_tree_joined.foreignkeyvalue WHERE IDPath LIKE @IDPath AND classname = 'CMS.Product' AND ( [ProductName] Like N'%'+ @Expression + N'%' OR [ProductDescription] Like N'%'+ @Expression + N'%' OR [ProductPhoto] Like N'%'+ @Expression + N'%' ) </query>
<query id="featured" type="querytext" transaction="false">SELECT top 1 *, dbo.COM_Product.ProductName AS COM_ProductName
FROM view_cms_tree_joined
INNER JOIN Content_Product ON content_product.ProductID = view_cms_tree_joined.foreignkeyvalue
INNER JOIN dbo.COM_Product ON dbo.COM_Product.ProductID = view_cms_tree_joined.comproductid
WHERE classname = 'cms.product' AND FeaturedProduct = 1 AND Published = 1 </query>
</queries>













Server Error in '/BibTrackKenticoCMS' Application.
--------------------------------------------------------------------------------

Column 'COM_ProductName' does not belong to table Table1.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Column 'COM_ProductName' does not belong to table Table1.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ArgumentException: Column 'COM_ProductName' does not belong to table Table1.]
System.Data.DataRow.get_Item(String columnName) +121
Kentico.CMS.TreeEngine.TreeNode.GetValue(String columnName)
Kentico.CMS.Form.CMSForm.SaveDataToDB()
Kentico.CMS.Form.BasicForm.SaveData(String redirectUrlAfterSave)
Kentico.CMS.Form.BasicForm.SaveDataClick(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain() +1277




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

User avatar
Guest
admin - 2/21/2006 6:51:12 PM
   
Re: CMSForm
Hi Jeremy,

could you please try to put back the original version of the "select" query? This query shouldn't be modified since its one of the basic system queries.

Please let me know if it helps.

Best Regards,

User avatar
Member
Member
JeremyThake - 2/22/2006 2:49:37 AM
   
Re: CMSForm
So that basically means I can't use the standard DataList CMSControl then because you can't specify the query it looks at. As it appears to use the select and selectbypath, that is why I customised them.

Basically it was to show the price of the CMS type Product I had created to save data duplication.

How would you suggest I get around this?

I can use a Repeater CMSControl and have a case statement on what level of the site I'm on on what transformation I use. But how do I say what query.config i use?

Jeremy

User avatar
Member
Member
JeremyThake - 2/22/2006 8:38:50 AM
   
Re: CMSForm
Ok, I've reversed these back to what they were...but for some reason it'll create new ones but on the edit when i profile the update statement being sent through it actually puts no ID as the parameter e.g productID is null in the parameters being passed and therefore no update is done.

Any ideas?

User avatar
Guest
admin - 2/22/2006 5:32:18 PM
   
Re: CMSForm
Hi Jeremy,

could you please try this:

1) copy your modified query selectbypath to a temporary file.
2) create and remove a temporary field to the document template so that it recreates the queries automatically.
3) test if it works.

Regarding the display issue: you can use custom queries with QueryDataList. However, this control doesn't support the "detail" view by default. You will need to ensure the "detail" view by showing a CMSViewer if some particular product is selected.

Please let me know if you need more details.

Best Regards,