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

Posted on 2005-05-16
Medium Priority
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
ID: 14012657
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 64

Expert Comment

by:Fernando Soto
ID: 14012792
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
ID: 14012868
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.
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

LVL 96

Expert Comment

by:Bob Learned
ID: 14012930
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
ID: 14013173

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 64

Expert Comment

by:Fernando Soto
ID: 14013288
I second that Jeff.

Author Comment

ID: 14018157
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 64

Accepted Solution

Fernando Soto earned 2000 total points
ID: 14018370
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 64

Expert Comment

by:Fernando Soto
ID: 14246778
Hi Bob;

I too would like a resolution on this question.


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.

601 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