Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,399 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,229 people online right now. Registration is fast and FREE... Join Now!




How to check if Table exist

 
Reply to this topicStart new topic

How to check if Table exist, vb.net 2003

itayzoro
post 24 Aug, 2008 - 03:36 AM
Post #1


New D.I.C Head

*
Joined: 29 Jul, 2008
Posts: 20

How to check if Table exist and if so a Field exist and if so is containe any records?

so far this what i have :

CODE


Dim sConnectionString, SQL24 As String
Dim dbFileNew As String = "C:\Dest.mdb"
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFileNew
SQL24 = "SELECT totalf AS Expr1 FROM TOTAL"
Dim Sconn As New System.Data.OleDb.OleDbConnection(sConnectionString)
Dim cmd24 As New System.Data.OleDb.OleDbCommand(SQL24, Sconn)
Dim dr24 As System.Data.OleDb.OleDbDataReader

        Try
            Sconn.Open()
            dr24 = cmd24.ExecuteReader()
            dr24.Read()
       If dr24.FieldCount = 0 Then
                MsgBox("No Field")
            Else
                MsgBox(dr24.Item("Expr1")) 'MsgBox("Exist")
            End If

            dr24.Close()
            Sconn.Close()
        Catch

        End Try
User is offlineProfile CardPM

Go to the top of the page

dineeshd
post 25 Aug, 2008 - 04:50 AM
Post #2


D.I.C Addict

Group Icon
Joined: 30 Jun, 2008
Posts: 557



Thanked 16 times

Dream Kudos: 575
My Contributions


You may get some help from this thread... rolleyes.gif

http://forums.devarticles.com/showpost.php...amp;postcount=4
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 07:44AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month