Error Opening System.InvalidOperationException database?

3

I'm using webMatrix, to develop an example in JqueryMobile, I'm having the following error

@{
    Layout="~/shared/_Layout.cshtml";
    Page.Title = "Home";
    Page.Header = "Categorias";
    var db  = Database.Open("Northwind40.sdf");
    var sql = @"SELECT [CATEGORY ID] AS ID, [CATEGORY NAME] AS NAME FROM CATEGORIES 
    ORDER BY [CATEGORY NAME]";
    var data = db.Query(sql);
}


<div data-role="content">

    <ul data-role="listview" data-inset="true" data-theme="d">

          @foreach(var item in data){
            <li><a href="/Category/@item.ID">@item.NAME</a></li>
          }

    </ul>

</div>

Error Message:

  Connection string "Northwind40.sdf" was not found.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.InvalidOperationException: Connection string "Northwind40.sdf" was not found.

    Source Error: 

    Line 3:      Page.Title = "Home";
    Line 4:      Page.Header = "Categorias";
    Line 5:      var db  = Database.Open("Northwind40.sdf");
    Line 6:      var sql = @"SELECT [CATEGORY ID] AS ID, [CATEGORY NAME] AS NAME FROM CATEGORIES 
    Line 7:      ORDER BY [CATEGORY NAME]";
    
asked by anonymous 20.05.2015 / 22:46

1 answer

0

Replace:

var db  = Database.Open("Northwind40.sdf");

By:

var db  = Database.Open("UmaConnectionStringVálida");

I do not know what database technology this Database object uses, but possibly this .sdf file does not even exist in your example.

    
20.05.2015 / 23:08