0

I have made a simple view in SQL and I need this transferred to C#. Firstly, I made a LINQ to SQL class. From the SQL Server Object Explorer, I drag-and-dropped the view into the .dbml designer. Then calling the select statement, like so:

var list = from test in testDB.v_TestView select test;

When running this command, I get the following error:

NullReferenceException: Object reference not set to an instance of an object

I'm not quite sure why this simple select statement is bothering me?

Here's the view I made:

CREATE VIEW [dbo].[v_TestView]
    AS select * from TestTable
Detilium
  • 2,868
  • 9
  • 30
  • 65

0 Answers0