Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » determining if an SQL database exists, etc.
Closed Thread
Old 04-12-2009, 05:39 PM   #1 (permalink)
 
Junior Techie

Join Date: Nov 2008

Posts: 79

BobLewiston is on a distinguished road

Default determining if an SQL database exists, etc.

Could someone please give me the simplest possible C# code snippets / SQL queries to determine whether:

* a given SQL database exists,
* a given existing SQL database is accessible, and
* a given table exists within a given existing SQL database?

Thanks for whatever help anyone can provide.
BobLewiston is offline  
Old 04-12-2009, 06:46 PM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: determining if an SQL database exists, etc.

list of databases and tables should be in the system tables

Connect to SQL Server from command prompt - list tables and database
office politics is offline  
Old 04-12-2009, 06:55 PM   #3 (permalink)
 
Junior Techie

Join Date: Nov 2008

Posts: 79

BobLewiston is on a distinguished road

Default Re: determining if an SQL database exists, etc.

office politics:

I want to be able to do this programatically.
BobLewiston is offline  
Old 04-12-2009, 07:15 PM   #4 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: determining if an SQL database exists, etc.

Best thing to do is attempt a connect and check the return.
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to obtain SQL Server FullText Search service? BobLewiston Programming Discussions 9 08-14-2009 08:24 AM
dataAdapter.Update / SQL PasswordHash NULL problem BobLewiston Programming Discussions 0 03-30-2009 12:04 AM
Running Sql Server database through on shared hosting? subxuk Web Site Hosting / ISP Q & A 3 11-28-2008 04:19 AM
Database Trojan infests pro-Tibet websites Osiris Virus - Spyware Protection / Detection 0 04-14-2008 08:44 AM
SQL and Access Database with Flash Interface djmaddogfreak Web Site Hosting / ISP Q & A 2 05-08-2007 04:16 PM