Solved

SQL Connection and DataAdapters

Posted on 2007-03-27
4
151 Views
Last Modified: 2010-04-23
When developing a VB.net application with SQL Server 2000, I'm developing the app on a development computer.  The app is going to be installed on another computer.

When I create the data adapters and SQL Connection, they point to the local database.  What happens when I install this on the intended PC?  Is this going to be a problem?

If this is going to be a problem, how can I address this now before I get too far into development?

Thanks!
0
Comment
Question by:tobin46
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Expert Comment

by:alfredwhang
ID: 18802963
i would use ip address in the connecction string.  the ip address can be changed anytime as you change your sql server...be it remote or local (as in localhost) checkout :

http://connectionstrings.com/?carrier=sqlserver

for a list of connection strings.
0
 
LVL 41

Assisted Solution

by:graye
graye earned 200 total points
ID: 18807611
Most folks put the connection string details in the application's XML-based *.config file.   That way you can easily use an text editor (like Notepad) to change the server (or other details) without having to recompile your application.

Under VB.Net you can create a connection string "Setting" by clicking on the "My Project" icon in the Solution Explorer window.  That will bring up a bunch of vertical tabs... one of which is "Settings".  The exact form you see at this point depends upon which version of VB.Net you have installed, but it should be fairily intutitive on how to add an item.
0
 
LVL 2

Accepted Solution

by:
alfredwhang earned 300 total points
ID: 18807945
if you are creating a product then i wouldn't advise you to store the connecting as is.  you should store individual information e.g. server address, DB login name and password etc.  in that way you can easily build a GUI which allows user to change/update information.  

if you store the connection string by itself then your program would need regex to extract the info (to display on the GUI so that users can edit/update) and this can be quite painful.

...but coming back to your original question, so long as you dont hard code your connection string and allow some means to change to connection string(either by GUI or by notepad), you should be fine.
0
 
LVL 3

Expert Comment

by:r1937
ID: 18839819
This is what I did some years ago:

instead of hadcoding the sql server name, I made it read it from the registry.
I made another application called "Application Admin" to set the server name in the registry.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 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