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 :
so far this what i have :
VB.NET:
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