Use VB.Net to connect with MSDE SQL and Server 2000

Posted on 2005-05-16
Last Modified: 2010-05-18
I would like to know my options on using VB.Net to work with MSDE 2000 datafile. I want to be able to use the MSDE 2000 to do my devlopment work then transfer the data file to SQL 2000 in a multi-usewr environment.
Question: How do I set up the connection to VB.Net so I can connect seamlessly to the same dataset in SQL 2000 and MSDE. If possible I should not have to make any changs to the connection string whne switching from MSDE to SQL 2000 and back  
Question by:Idarac
    LVL 24

    Expert Comment

    by:Jeff Certain
    The connection strings should be identical for SQL and MSDE, assuming you have the same user in both servers, with the same password and same permissions...
    LVL 62

    Expert Comment

    by:Fernando Soto
    And lets not forget the  Data Source in the connection string, as long as they do not differ between the two.
    LVL 24

    Expert Comment

    by:Jeff Certain
    Good call, Fernando.

    Maybe I'll just say it this way: The connection string formats are the same. Making the details match your particular server is your own responsibility... there is no way to make the two connection strings identical, since you're hitting different servers -- unless you use DSN, which will cause it's own issues.
    LVL 96

    Expert Comment

    by:Bob Learned
    With MSDE, isn't the server name taken from the machine name?  If so, then the connection string would be best created in an Application config file:

    Storage of Connection String in .config file:

    LVL 24

    Expert Comment

    by:Jeff Certain

    As a matter of personal preference, I'd store connection strings for a production machine somewhere other that the config file. Something about putting my user credentials into a plain-text file just doesn't sit well. Encrypted registry entries are a little more my style...

    LVL 62

    Expert Comment

    by:Fernando Soto
    I second that Jeff.
    LVL 1

    Author Comment

    I am doing the develoment work independently and when finished sending the database and application off to the client. So I can setup my environment the same as the client.

    Can anyone give me an source code example of what a conection stirng would look like?

    Part of my question was the diferent options? DSN etc.
    LVL 62

    Accepted Solution

    Hi  Idarac;

    You can construct a connection string with the following parameters and connect to the database.

    Parameters                 Description
    Data Source Or
    Server          Or          The name or network address of the server

    Initial Catalog Or
    Database                  The name of the database

    Password      Or
    PWD                       The password of the sql server account logging in

    User ID       Or
    UID                         The sql server log in account.

    So a connection string could look like this.

    Dim ConnectionStr As String = “Data Source = ClientServer; “ & _
        “Initial Catalog = ClientDatabase; UID = ClientAccount; “ & _
        “PWD = ClientPassword”

    See this link for other options that can be used in the connection string..

    Hope this was of some help
    LVL 62

    Expert Comment

    by:Fernando Soto
    Hi Bob;

    I too would like a resolution on this question.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now