简体   繁体   English

获取特定于登录用户的数据

[英]Getting Data Specific to Logged in user

I need to list logged in users active leads,and allow paging and selectable sorting, I cant use the grid because of the layout requirement. 我需要列出已登录用户的活动线索,并允许分页和可选排序,由于布局要求,我无法使用网格。

I have been searching the web for the last 2 days and cant find any viable solution 我过去两天一直在网上搜索,找不到任何可行的解决方案

Any help or direction would be greatly appreciated. 任何帮助或指示将不胜感激。

var query = db.Query("SELECT a.listingId, a.datetime, c.details, c.buycommercial, c.buyindustrial, c.buyretail, c.buyland, c.tencommercial, c.tenindustrial, c.tenretail, c.tenland, c.investor, c.developer, d.companyname, d.firstname, d.lastname, d.tel, d.cell, d.email FROM dbo.tblactivebroker a JOIN dbo.tblActiveListing b ON a.ListingId = b.ListingId JOIN dbo.tblListings c ON b.ListingId = c.ListingId JOIN dbo.tblContact d ON c.crmid = d.id WHERE b.active = 'True' AND a.ActiveBrokerID = @0",brokerid);

If you're talking about extending the query, you can use a string.Format. 如果要扩展查询,则可以使用string.Format。

Example: 例:

var query = db.Query(string.Format("SELECT a.listingId, a.datetime, c.details, c.buycommercial, c.buyindustrial, c.buyretail, c.buyland, c.tencommercial, c.tenindustrial, c.tenretail, c.tenland, c.investor, c.developer, d.companyname, d.firstname, d.lastname, d.tel, d.cell, d.email FROM dbo.tblactivebroker a JOIN dbo.tblActiveListing b ON a.ListingId = b.ListingId JOIN dbo.tblListings c ON b.ListingId = c.ListingId JOIN dbo.tblContact d ON c.crmid = d.id WHERE b.active = 'True' AND a.ActiveBrokerID = {0} AND a.listingId = {1} ORDER BY a.ActiveBrokerID", brokerId, listingId)) 

However, it is 2012 and a better approach would be to use LINQ and Entity Framework . 但是,现在是2012年,更好的方法是使用LINQEntity Framework

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM