Solved

SQL Connection and DataAdapters

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

12 Experts available now in Live!

Get 1:1 Help Now