I searched on google and stackoverflow and I did not find an answer, how can I connect to my database table through this connection string in VS 2010?
<add name="ArticleDBContext" connectionString="Data Source=mssql3.webio.pl,2401;Initial Catalog=db_name;Persist Security Info=True;User ID=db_user;Password=passwd;Pooling=False" providerName="System.Data.SqlClient" />
I always get the error: problem with [SqlException (0x80131904): invalid object name 'dbo.TableName'.]
I know that "dbo" is SCHEMA, I donβt need it, how can I change it?
I use mvc and EntityFramework
and the code is as follows:
in models:
public class Article { public int ID { get; set; } public string Title { get; set; } public DateTime CreateDate { get; set; } public string tekst { get; set; } } public class ArticleDBContext : DbContext { public DbSet<Article> Articles { get; set; } }
and in the controller:
public ViewResult Index() { return View(db.Articles.ToList()); }
an example is taken from http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part4-cs
source share