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
Solved

SQL Connection and DataAdapters

Posted on 2007-03-27
4
149 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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