Vote count:
0
public class UserController : Controller { // // GET: /User/
db_MVCEntities context = new db_MVCEntities();
public ActionResult Index(tblLogin log)
{
var login = from o in context.tblLogins
join od in context.tblReaders
on o.ReaderId equals od.ReaderId
where o.Username=="user"
select new { od.ReaderName};
if (login != null)
{
Session["uname"] = login.ToString();
return View(context.tblBookInfoes.ToList());
}
return View("Index");
}
I'm trying to join 2 tables tblLogin and tblReader. dB_MVCEntities is my entity and it contains tblLogins and tblReaders rly. Here I have to take the name of the reader from tblReader where username is given in the tblLogin table using join. But its not working :( The output seems like SELECT [Extent1].[ReaderId] AS [ReaderId], [Extent2].[ReaderName] AS [ReaderName] FROM [dbo].[tblLogin] AS [Extent1] INNER JOIN [dbo].[tblReader] AS [Extent2] ON [Extent1].[ReaderId] = [Extent2].[ReaderId] WHERE 'user' = [Extent1].[Username] Please help
asked 1 min ago
Join in asp.net mvc4
Aucun commentaire:
Enregistrer un commentaire