我有一个WCF服务,我添加了一个数据库,我正在使用EF,但是当我尝试连接到数据库时,我遇到了这个问题......
public Producenci GetProducent(int id)
{
dbMagazynierEntities context = new dbMagazynierEntities();
context.Database.Connection.Open();
var producent_entity = (from p in context.Producenci
where p.ID == id
select p).FirstOrDefault();
context.Dispose();
if (producent_entity != null)
{
return TranslateProducentEntity2Producent(producent_entity);
}
else
{
throw new Exception("error");
}
}
我得到了
用户'登录失败。'
这是我的CS
<connectionStrings><add name="dbMagazynierEntities" connectionString="metadata=res://*/MagazynierEntity.csdl|res://*/MagazynierEntity.ssdl|res://*/MagazynierEntity.msl;provider=System.Data.SqlClient;provider connection string="data source=PIOTR-TOSH\Piotr;initial catalog=dbMagazynier;integrated security=false;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings></configuration>