Afterefect of changing connectionstring in c# linq

-1

A few days ago I had problem with saving data into my database using Linq and I was told the solution to my problem is changing stingconnection from AttachDbFilename to Database=name. I did that. I have changed it in Settings and app configuration and it created another problem. Now there's error I don't know how to fix so I'm asking you guys what to do because I don't wanna remake my connection and work on everything once more.

I'm using Linq and WPF.

If you are interested in code and what I did you can check it WPF- LINQ Database doesn't update.

Error Code I got after trying to compile is:

System.ArgumentException HResult=0x80070057 Message=Format ciągu inicjowania jest niezgodny ze specyfikacją, począwszy od indeksu 35.
Source=System.Data StackTrace: at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value) at System.Data.Linq.SqlClient.SqlProvider.GetDatabaseName(String constr) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Initialize(IDataServices dataServices, Object connection) at System.Data.Linq.DataContext.Init(Object connection, MappingSource mapping) at System.Data.Linq.DataContext..ctor(String fileOrServerOrConnection, MappingSource mapping) at portiEX.DataBaseConnectionsDataContext..ctor() in C:\Users\USER\Downloads\portiEXzDB(1)\portiEXzDB\portiEX\DataBaseConnections.designer.cs:line 54 at portiEX.LoggingPage..ctor() in C:\Users\USER\Downloads\portiEXzDB(1)\portiEXzDB\portiEX\LoggingPage.xaml.cs:line 23

This exception was originally thrown at this call stack: [External Code] portiEX.DataBaseConnectionsDataContext.DataBaseConnectionsDataContext() in DataBaseConnections.designer.cs portiEX.LoggingPage.LoggingPage() in LoggingPage.xaml.cs

Fragment of code that shows error above:

public DataBaseConnectionsDataContext() : 
    base(global::portiEX.Properties.Settings.Default.PortiEXDBsConnectionString, mappingSource)
{
    OnCreated();
}

Screenshot of error:
Screenshot of error

If its dumb question, easy to solve Im sorry but I still would like to get info how to solve it.

Thank you in advance and have nice day!

c#
sql
linq
asked on Stack Overflow May 16, 2020 by Luke • edited May 17, 2020 by ASh

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0