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

Join 136,306 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,462 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
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
+Quote Post

dineeshd
RE: How To Check If Table Exist
25 Aug, 2008 - 04:50 AM
Post #2

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 578



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 offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 06:35AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month