C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




C# code to check the table is exists in the oracle database


Posted Date: 17 Sep 2008    Resource Type: Code Snippets    Category: ADO.NET

Posted By: Shivashankar Chincholi       Member Level: Gold
Rating:     Points: 10



//C# code to check the table is exists in the oracle database


try
{

DataSet dataSet = new DataSet();
string connstr = "provider=MSDAORA.1;User ID=scott;Data
Source=<server>/<database>;Password=tiger;";
string query = "SELECT * FROM USER_TAB_COLUMNS WHERE
TABLE_NAME='CUSTOMER'";

using (OleDbConnection connection = new OleDbConnection(connstr))
{

connection.Open();

using (OleDbDataAdapter adapter = new OleDbDataAdapter(query,
connection))
{
adapter.Fill(dataSet, "CUSTOMER");
}

}

if (dataSet.Tables[0].Rows.Count > 0)
{
Trace.Write("Table exists in database");
}
else
{
Trace.Write("Table does not exists in database");
}

}
catch (Exception ex)
{
throw ex;
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Table  .  Oracle  .  Exists  .  Database  .  Check  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Connectivity of SQL to C#
Previous Resource: Retriving Database Fields Using DataReader
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use