Solved

SQL Connection and DataAdapters

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

895 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

13 Experts available now in Live!

Get 1:1 Help Now