locked
database cannot be made RRS feed

  • Question

  • User70143981 posted

    whenever i tried to make a new database in visual basic 2008 i got an error message:

    "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfces, error:26 - Error Locating Server/Instance Specified)"

    please tell me how this error be removed

    Thursday, January 9, 2014 3:46 AM

Answers

  • User-933407369 posted

    hi ,

    At first, you are able to access to your SqlServer.

    And, you need to check out your web.config file and find the node below:

    <connectionStrings>
          <add name="MyNorthwindConnectionString" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=MyNorthwind;Integrated
    Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework" providerName="System.Data.SqlClient" /> </connectionStrings>

    or

      <appSettings>
        <add key="MyNorthwindConnectionString" value="Data Source=(localdb)\v11.0;Initial Catalog=MyNorthwind;Integrated 
    Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework" />
    </appSettings>

    the two postion above would access to your  sql server.
    if you don't find then in your webconfig, you need to search for SqlConnection on your entire solution, find the code below:

       //SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyNorthwind"].ConnectionString);
       SqlConnection con = new SqlConnection("here is your connectionstring");

    you need to make sure that it is correct.

    Hope it helps you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 10, 2014 5:08 AM

All replies

  • User-1998339254 posted

    Pls check the connection details

     str = "CREATE DATABASE MyDatabase ON PRIMARY " +
            "(NAME = MyDatabase_Data, " +
            "FILENAME = 'C:\\MyDatabaseData.mdf', " +
            "SIZE = 2MB, MAXSIZE = 10MB, FILEGROWTH = 10%) " +
            "LOG ON (NAME = MyDatabase_Log, " +
            "FILENAME = 'C:\\MyDatabaseLog.ldf', " +
            "SIZE = 1MB, " +
            "MAXSIZE = 5MB, " +
            "FILEGROWTH = 10%)";

    follow this links

    http://www.codeproject.com/Tips/101735/Creating-a-SQL-Server-Database-Programmatically

    http://www.codeproject.com/Articles/23823/Create-a-SQL-Database-Programmatically

    http://www.c-sharpcorner.com/UploadFile/mahesh/CreatingDBProgrammaticallyMCB11282005064852AM/CreatingDBProgrammaticallyMCB.aspx

    Thursday, January 9, 2014 3:51 AM
  • User70143981 posted

    from where i check connection details?

    how i check connection detail?

    Thursday, January 9, 2014 4:27 AM
  • User-933407369 posted

    hi ,

    At first, you are able to access to your SqlServer.

    And, you need to check out your web.config file and find the node below:

    <connectionStrings>
          <add name="MyNorthwindConnectionString" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=MyNorthwind;Integrated
    Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework" providerName="System.Data.SqlClient" /> </connectionStrings>

    or

      <appSettings>
        <add key="MyNorthwindConnectionString" value="Data Source=(localdb)\v11.0;Initial Catalog=MyNorthwind;Integrated 
    Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework" />
    </appSettings>

    the two postion above would access to your  sql server.
    if you don't find then in your webconfig, you need to search for SqlConnection on your entire solution, find the code below:

       //SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyNorthwind"].ConnectionString);
       SqlConnection con = new SqlConnection("here is your connectionstring");

    you need to make sure that it is correct.

    Hope it helps you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 10, 2014 5:08 AM