Solved

return value when connected to a database

Posted on 2004-09-13
1
147 Views
Last Modified: 2010-04-23
I am creating a database program in winforms

I have a program currently going to the machine box for the database.

i will be implementing an online database.

what I need is something like this


If connection to onlinedb = True
then online connection string
Else
offline connection string

is there a way to get a value if I connect properly to a DB.

Thanks
0
Comment
Question by:malanois
1 Comment
 
LVL 18

Accepted Solution

by:
DotNetLover_Baan earned 250 total points
ID: 12050573
yes of course.
If you are using SqlServer, use System.Data.SqlClient namespace
If you are using SqlServer, use System.Data.OleDb namespace

After creating the connection, check the "State" property om that connection
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataSqlClientSqlConnectionClassStateTopic.asp
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataOleDbOleDbConnectionClassStateTopic.asp
-Baan
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

14 Experts available now in Live!

Get 1:1 Help Now