Solved

return value when connected to a database

Posted on 2004-09-13
1
152 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sql server insert 13 43
VB.NET 2008 Publish Error 2 43
VB.net SQLCommandBuilder Insert New Records From DataGridView 3 30
vb.net Configuration, settings file location? 8 41
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

679 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