Solved

SQL Connection and DataAdapters

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Make all values in arrayist to titlecase+vb.net 23 32
VB.Net - Project Software to help the Developer 7 33
Disable extension 8 37
start a process from a service 3 21
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

786 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