Search code examples
c#asp.netpetapoco

Failed to read database schema


im newbie in c# and i want fetch data from mssql local engine with peta poco orm but i get this error image of error im getting and here is my connection string of my class library:

  <connectionStrings>
 <add name="School" connectionString="Data Source= MSSQLSERVER;Initial Catalog=School;user id=sa; Password=1qaz!QAZ;" providerName="System.Data.SqlClient" />
 </connectionStrings>

my database name is School, i tried server too, and my server name which i use to connect to ssms is DESKTOP-KVEJKDS thanks for your help!


Solution

  • Just replace your Data Source name with your Server name:

    <connectionStrings>
     <add name="School" connectionString="Data Source= DESKTOP-KVEJKDS\SQLEXPRESS;Initial 
    Catalog=School;user id=sa; Password=1qaz!QAZ;" providerName="System.Data.SqlClient" />
     </connectionStrings>