开发者

Joining Tables in ASP.NET

Ambiguous Error.. It highlights this line:

bojDA.Fill(objDS, "ShopCart");

and right above that is my select statement which looks like:

any advice on this issue now would be helpful, thank you

Thank you

I think the new error has something to do with:

SELECT productid,productname,productsku,quantity,productprice,productprice * quantity AS TotalPrice,ShoppingCartRecID,UOM,PackingSlip,LogoDesignNumber,CustomText,NameText,ExtraCharge,custitem,t1.CatalogT开发者_运维知识库ype,CatalogID,RelatedChargeID,UPSFlag FROM ShoppingCart t1 INNER JOIN ItemCatalogProfile t2 on t1.CatalogType = t2.Integration

when i try entering this into SQL Server, it just pulls back empty columns


Just join the tables in the select query that's used to bind the GridView (or other databound control), like this:

SELECT Table1.Column1,
       Table2.Column2
FROM   Table1
       INNER JOIN Table2
           ON Table1.SomeColumn = Table2.SomeColumn


There are two ways to work with data from a persistant store. One is to grab raw data and attempt to shape it on the UI layer. The other is to shape the data when you retrieve it. Okay, technically, you can shape the data at any layer.

Your issue is largely due to having one data definition throughout your application. You have the same data definition in the database, the business logic and the UI. For some of the layers, separating out the data into two "sources" (or similar), where the data has different names, depending on context.

The direction I would take to solve the problem is create a "view model" that has the bits named correctly for the purpose of this particular page. You need not change the data structure throughout all layers to do this. Just shape the data for the UI before you bind it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜