c# - The underlying provider failed on Open in entity framework connection -
i use entity framework in .net 4 , use connection in project:
<add name="database1entities" connectionstring="metadata=res://*/model.model1.csdl|res://*/model.model1.ssdl|res://*/model.model1.msl;provider=system.data.sqlclient;pr ovider connection string="data source=.\sqlexpress;attachdbfilename=|datadirector y|\database1.mdf;initial catalog=database1;integrated security=true;user instance=true;multipleactiveresultsets=true"" providername="system.data.entityclient" />
and show error:
the underlying provider failed on open.
i don't know why error use connection string , don't have problem. remember name of dbcontext class , connection string should same
<add name="mydb" connectionstring="server=127.0.0.1;user id=sa;password=password;database=database" providername="system.data.sqlclient"/>
Comments
Post a Comment