vbdotnet.it

Tricks & tips, workaround, forum and ideas with .Net

About the author

Enrico Rossini è il gestore di questo blog.
E-mail me Send mail

Recent posts

Recent comments

Contributi

Best 6 ~ 6 users ~ 6 comments

Info legali

Le opinioni espresse in questo blog sono strettamente personali e ogni persona è responsabile dei commenti che inserisce. I marchi citati sono delle rispettive aziende.

© Copyright 2010

Advertising


Esistenza di una tabella nel database

Ogni tanto c'è la necessità di sapere se sul database è presente una tabella oppure no. Con il seguente codice possiamo verificare facilmente se una tabella esiste. Il parametro da passare è comprensivo di schema, per esempio dbo.Anagrafiche.

In VB.NET:

Function TableExists(tableNameAndSchema As String) As Boolean
   Using connection As New SqlConnection(connectionString)
      Dim checkTable As String = [String].Format("IF OBJECT_ID('{0}', 'U') IS NOT NULL SELECT 'true' ELSE SELECT 'false'", tableNameAndSchema)
      Dim command As New SqlCommand(checkTable, connection)
      command.CommandType = CommandType.Text
      connection.Open()
 
      Return Convert.ToBoolean(command.ExecuteScalar())
   End Using
End Function

e anche in C#:

bool TableExists(string tableNameAndSchema){
   using (SqlConnection connection = new SqlConnection(connectionString))
   {     
     string checkTable = String.Format(
                         "IF OBJECT_ID('{0}', 'U') IS NOT NULL SELECT 'true' ELSE SELECT 'false'", tableNameAndSchema);
       SqlCommand command = new SqlCommand(checkTable, connection);
      command.CommandType = CommandType.Text;
      connection.Open();
 
      return Convert.ToBoolean(command.ExecuteScalar());   
   }
}

Ciao e buon lavoro!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by enrico on Thursday, July 01, 2010 3:43 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Progetti OpenSource in .NET

Ho trovato in giro per la rete diversi progetti OpenSource sviluppati in .NET sia in VB che in C#. L'elenco è interessante e quindi ve lo pubblico.

e-Commerce / Online Shopping Carts
  1. Dash Commerce - dashcommerce
  2. Dot Shopping Cart - dotshoppingcart
  3. VevoCart - vevocart
  4. e-Shop ASP.NET - e-shop
  5. PressTopia Shop - Presstopia
Content Management Systems
  1. Umbraco - Umbraco
  2. Rainbow Portal - Rainbow Portal
  3. DotNetNuke - Dotnetnuke
  4. The Beer House - TheBeerHouse
  5. My Web Pages Starter Kit - MyWebPagesStarterKit 
  6. Basic CMS - basic-cms
  7. JMD CMS - JMDCMS
  8. Nickel & Dime CMS - ndcms
  9. Nolior EZNews - nolioreznews
Blogs / Blogging
  1. Blog Engine .NET - dotnetblogengine.net
  2. DasBlog - dasblog
  3. Sub Text - subtextproject
  4. PressTopia - presstopia 
Link Directories
  1. (ASPLD) ASP.NET 3.5 Link Directory - n3o
  2. XD Link Directory - ex-designz
  3. ASP.NET 2.0 Link Directory - davemackey
Customer Relationship Management (CRM)
  1. Splendid CRM - splendidcrm
Wiki's
  1. FlexWiki - flexwiki
  2. ScrewTurn Wiki - screwturn 
Forum / Portals / Networks
  1. Kigg (Digg like application) - Kigg
  2. Club Starter Kit - ClubStarterKit
  3. Mojoportal for Windows and Mono - Mojoportal
  4. Drop Things (Web 2.0 Portal) - Dropthings
  5. Yet Another Forum - Yetanotherforum
  6. DMG Forum - Dmgforums
Recruitment / Job Systems
  1. Job Site Starter Kit - binaryintellect
  2. Stock / Inventory Tracker - itracker
Web / E Mail
  1. DotNet Open Mail - dotnetopenmail
  2. qqMail - umailcampaign
  3. Sharp Web Mail - sharpwebmail
Image & Video Galleries
  1. Media Library Starter Kit - media-library
  2. ASP.NET Foto Gallery - pentabyte
  3. gPhotoNet - PhotoNet
Classifieds
  1. Classifieds Starter Kit - msdn
  2. Dating .NET - joemay
Misc
  1. ASP.NET Small Business Web Site Starter Kit - Starter kit
  2. ASP.NET Personal Site
  3. Time Tracking Website - Time tracking
  4. DinnerNow (Food Ordering System) - Dinner now
  5. Bug Tracker .NET - Bug tracker

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: asp.net | vb.net | c#
Posted by enrico on Tuesday, September 23, 2008 1:18 AM
Permalink | Comments (0) | Post RSSRSS comment feed