Current filter:
                                You should refresh the page.
                                  • Description:
                                    When I'm trying to change the connection string in a demo, I get an error

                                    "A network-related or instance-specific error occurred while establishing a connection to SQL Server..."
                                    "The user instance login flag is not supported on this version of SQL server."
                                    "Could not open new database X ..."

                                    Our code automatically detects the available database engines.
                                    When launching a particular demo that requires the SQL Server, our code looks for available SQL Server instances and changes the default connection string to connect to this server. However, in some cases this mechanism may fail or you may want to use a custom SQL Server. In this case, a reasonable action is to change the connection server to the appropriate one, but this solution won't work as our patcher will be still functional and it will break the connection string, as the patcher is not intended to work with custom connection strings.

                                    To avoid this behavior, you will need to disable the patcher.

                                    Starting with v17.1.6, set the PatchConnectionStrings configuration setting to false to disable the patcher.

                                    <appSettings> <add key="PatchConnectionStrings" value="false"/> </appSettings>

                                    For older versions:

                                    Usually, it is called from the Global.asax file:

                                    private static string DatabaseConnectionString { get { string sqlExpressString = ConfigurationManager.ConnectionStrings["ClinicalStudyContext"].ConnectionString; return DbEngineDetector.PatchConnectionString(sqlExpressString); } }
                                    Private Shared ReadOnly Property DatabaseConnectionString() As String Get Dim sqlExpressString As String = ConfigurationManager.ConnectionStrings("ClinicalStudyContext").ConnectionString Return DbEngineDetector.PatchConnectionString(sqlExpressString) End Get End Property

                                    You will need to change this code to make the custom connection string work:

                                    private static string DatabaseConnectionString { get { return ConfigurationManager.ConnectionStrings["ClinicalStudyContext"].ConnectionString; } }
                                    Private Shared ReadOnly Property DatabaseConnectionString() As String Get Return ConfigurationManager.ConnectionStrings("ClinicalStudyContext").ConnectionString End Get End Property

                                    If you didn't find this code, you can search for "PatchConnectionString" string using the Visual Studio search window.
                                    See Also:
                                    The Connection String Reference

                                • John Holliday 04.05.2013

                                  This approach does not work if the database is not local. Is there a solution for connecting the demos to a remote database server?

                                • Mike (DevExpress Support) 04.08.2013

                                  @John: This KB Article contains common instructions. I have created a new ticket on your behalf to process your inquiry more effectively:
                                  Q373381 - How to configure SQL Server for demo databases when using remote database

                                • Mark C 04.09.2014

                                  Hello Mike,
                                      That worked.
                                  Thank you for your help,

                                • Matthias Klein 06.16.2015

                                  I have VS 2013 and I tried all possible combinations, but it still won't connect to the database.
                                  My current connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=True;"
                                  And I get the following error:
                                  {"An attempt to attach an auto-named database for file ...\Documents\Samples\MVC GridView\14.2.7\E5038\Q559000\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."}

                                • Mike (DevExpress Support) 06.16.2015

                                  Hello Matthias,

                                  To process your recent post more efficiently, I created a separate ticket on your behalf: T256130: GridView Demos - An attempt to attach an auto-named database for file aspnetdb.mdf failed in VS2013. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

                                0 Solutions

                                Creation Date Importance Sort by