none
There is no SQL Server

    Question

  • Hello.I am trying to add a new sql connection with vb.net 2010,2012,2013 (yes i tried them all).But in the "Add Connection" windows there is no sql server in "Server Name" dropdown.I checked sqlserver from services,its running.What should i do? Thank you very much.
    Sunday, September 15, 2013 9:35 PM

Answers

  • I don't have the same verion of VS that you do.  Normally there are two methods of connecting to the SQL database

    1) To connected to an mdf file

    2) Connect to the Service that is automatically started when the computer is turned on or can be setup to be manually started

    Method 2 is the prefered method and I will assume right now that the service is automatically started.  It looks like from your screen shot on the left pane you selected data conmnection which is method 1.  If you continue you should be asked to browse for the mdf file on the local computer.

    I would go back on the left pane an instead select computer that you have blacked out.  If the database is on another computer then I would think you would use the shared point connection and choose the computer where the database is located.


    jdweng

    Wednesday, October 02, 2013 1:41 AM

All replies

  • Below are the normal connection string for SQL Standard and SQL Express.  Notice that you use a "Data Source" (not a "Data Provider").  A Data Provider requires setting up a driver to make a connection.  You can use the code below to make the connection rather than use the Menu to add the connection.  If you use the menu make sure you are selecting the Data Source, not the Data Provider.

    Imports System.Data.SqlClient
    Module Module1
        Sub Main()
            Dim serverName As String = "Myserver"
            Dim databaseName As String = "MyDatabase"
            Dim strConExpress As String = String.Format("Data Source={0}\\SQLEXPRESS;" & _
                   "Initial Catalog={1};Integrated Security=SSPI", _
                   serverName, databaseName)
            Dim strConStandard As String = String.Format("Data Source={0}\\SQLSTANDARD;" & _
                   "Initial Catalog={1};Integrated Security=SSPI", _
                   serverName, databaseName)
            Dim conn As SqlConnection = New SqlConnection(strConStandard)
            conn.Open()
        End Sub
    End Module


    jdweng

    Sunday, September 15, 2013 11:54 PM
  • Yes, with code v.s. working well.But the problem which is i sad before, server invisible at "Add Connection" window.
    Monday, September 16, 2013 10:54 AM
  • Sorry.  I could tell from you posting if the VS code was working.  It appears that ODBC connection that is defined on the PC will work.  Then forms and menu arre not very clear.  Did you setup a database from the DATA menu before trying to add a connection?


    jdweng

    Monday, September 16, 2013 11:16 AM
  • today I installed windows xp and its working well.so,what is wrog with w7 and w8?
    Monday, September 16, 2013 8:53 PM
  • Thanks Joel’s help.

    Hi imparatore,

    Thank you for posting in the MSDN forum.

    But in the "Add Connection" windows there is no sql server in "Server Name" dropdown.

    Could you share me a screen shot about it? How can I repro this issue in my side with VS2010 in windows 7? Could you share me the detailed steps to repro this issue?

    Do you mean that right click Data Connections -> Add Connecttion… in Server Explorer window? Do you mean that you couldn’t get the Sql Server option like the following screen shot?

    Best Regards,


    Jack Zhai[MSFT]
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 18, 2013 5:23 AM
    Moderator
  • Yes I followed your steps,then I got problem.
    Wednesday, October 02, 2013 12:45 AM
  • I don't have the same verion of VS that you do.  Normally there are two methods of connecting to the SQL database

    1) To connected to an mdf file

    2) Connect to the Service that is automatically started when the computer is turned on or can be setup to be manually started

    Method 2 is the prefered method and I will assume right now that the service is automatically started.  It looks like from your screen shot on the left pane you selected data conmnection which is method 1.  If you continue you should be asked to browse for the mdf file on the local computer.

    I would go back on the left pane an instead select computer that you have blacked out.  If the database is on another computer then I would think you would use the shared point connection and choose the computer where the database is located.


    jdweng

    Wednesday, October 02, 2013 1:41 AM