Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<connectionStrings>
		<add name="constr1"
			 connectionStrings ="Data Source=DESKTOP-624ATVA\Mjavadabedi;Initial Catalog=sign in data;Integrated Security=true"
		providerName="System.Data.SqlClient"/>
	</connectionStrings>



C#
class Db : DbContext
    {
        public Db() : base("name=constr1")
        {

        }

        public DbSet<human> humans { set; get; }


the error:

Inner Exception 1:
ConfigurationErrorsException: Unrecognized attribute 'connectionStrings'. Note that attribute names are case-sensitive. (C:\Users\IT CITY\source\repos\ثبت\sing in\sing in\bin\Debug\sing in.exe.Config line 14)

What I have tried:

i don't know what to do
i checked the names and they were ok
i checked the sql because i thank that maybe the problem is from that
Posted
Updated 15-Mar-24 10:56am
v2

1 solution

I think the issue is an easy fix per this documentation Connection Strings and Configuration Files - ADO.NET | Microsoft Learn[^]

The difference being that the inner part should be "connectionString" instead of "connectionStrings"


Try:
XML
<connectionStrings>
		<add name="constr1"
			 connectionString ="Data Source=DESKTOP-624ATVA\Mjavadabedi;Initial Catalog=sign in data;Integrated Security=true"
		providerName="System.Data.SqlClient"/>
	</connectionStrings>


Finally, if you're using SQL Server 2022, you may also need to add ";Encrypt=False" to the end of your connection string. At least helps with my local debugging.
 
Share this answer
 
v3
Comments
Richard MacCutchan 15-Mar-24 13:45pm    
Your formatting has included some extra bits that should not be there.
snorkie 15-Mar-24 14:25pm    
Thanks, updated.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900