I'm working in Visual Studio 2012 and trying to connect my website to an mdf database file (sisgar.mdf):
I have tried to connect with this code:
@{
var base_dados = Database.Open("sisgar");
string query = ("select * from tb_porteiro");
var resultados = base_dados.Query(query);
<table>
@{
foreach ( var linha in resultados )
{
<tr>
<td>@linha.idp </td>
<td>@linha.porteiro </td>
</tr>
}
}
The mdf is in the right folder, the table exists, have the fields
Exists another way to connect to the mdf