dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online Memberspragna
Abul Bashar Sardar
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » ASP.NET »

Data table


Posted Date: 05 Aug 2010      Posted By:: Vinitha V     Member Level: Bronze    Member Rank: 4038     Points: 1   Responses: 3



How can I check whether a data table is already existed or not? If there is the data table I need to save some data. Other wise I need to create it.

So How can I check whether a data table is already created or not in ASP .NET C# code in web application?




Responses

#535066    Author: Shekar.Y      Member Level: Gold      Member Rank: 104     Date: 05/Aug/2010   Rating: 2 out of 52 out of 5     Points: 2

You want the check if the data table exists or not in data set or in the database ?

if(dataSet.Tables.Count == 0)
{
//Create a new data table here and add to the data set.
}


Query for checking weather the table exists or not.

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableName]') AND type in (N'U'))


Thanks
Shekar.Y



 
#535089    Author: vasanth      Member Level: Silver      Member Rank: 885     Date: 05/Aug/2010   Rating: 2 out of 52 out of 5     Points: 2

if(dataSet.Tables.Count != 1)
{ //Create a new data table here and add to the data set.}



 
#535158    Author: VASANTH R      Member Level: Gold      Member Rank: 309     Date: 05/Aug/2010   Rating: 2 out of 52 out of 5     Points: 2

you can check by DataSet.Tables.Count

Or

You can loop through
for(Int32 idx=0; idx<DataSet.Tables.Count; idx++)
{
if (DataSet.Tables[idx].TableName==<<The name you are checking>>)
{

}
}

Regards,
R.Vasanth






 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Deployment in ASP.Net using IIS
Previous : Image display
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.