Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I want to Crete report viewer with 2 tables has relationship in my application in asp.net mvc , I am using Entity Framework Code first , so i create my database using migration .

What I have tried:

This is my stored prouder:

CREATE PROCEDURE [dbo].[ReportExpenseDetails]
	
AS
	SELECT 

	e.Expenses_Id as ExpenseNo,
	e.Expenses_Type,
	

   ed.ExpenseDetails_Id,
    ed.ExpensesId,
	ed.Amount,
	ed.DateExpense,
	ed.Note
	
	    from Expenses as e inner join ExpenseDetails as ed on e.Expenses_Id=ed.ExpensesId

RETURN 0


This is my ExpenseDetails models :

public class ExpenseDetails
{
    [Key]
    public int ExpenseDetails_Id { get; set; }

    public double Amount { get; set; }

    [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
    public DateTime DateExpense { get; set; }

    public string Note { get; set; }

    public int ExpensesId { get; set; }

    [ForeignKey("ExpensesId")]
    public virtual Expenses expenses { get; set; }
}


This is Expenses Model:

public class Expenses
{
    [Key]
    public int Expenses_Id { get; set; }

    public string Expenses_Type { get; set; }
}
Posted
Updated 21-Apr-19 7:12am

1 solution

 
Share this answer
 
Comments
Member 14317227 21-Apr-19 14:27pm    
Thank you , But I do not understand can help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900