ado.net - Why is this error connection database asp.net mvc -


why error

an exception of type 'system.data.entity.core.entityexception' occurred in entityframework.sqlserver.dll not handled in user code

when using this:

department data  = conn.dep_con.single(x => x.depid == id);  

web.config

<connectionstrings>     <add name="databaseconn" connectionstring="data source=localhost;initial catalog=companye;integrated security=true" providername="system.data.sqlclient" /> </connectionstrings> 

its because have no data in table current depid, try changing code , see if solves issue.

department data  = conn.dep_con.singleordefault(x => x.depid == id);  

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -