Check the table whether it exist or not

Wednesday, April 29, 2009

Private Function fcheckTable(ByVal sDatabaseName As String, ByVal Tablename As String) As Boolean
Try
fcheckTable = False
Dim sSQL As String = "show tables in " & sDatabaseName
objCmd = New OdbcCommand(sSQL, ObjCon)
Dim oRS As Odbc.OdbcDataReader = objCmd.ExecuteReader
Do While oRS.Read
If Trim(UCase(Tablename)) = Trim(UCase(oRS(0))) Then fcheckTable = True
Loop
oRS.Close()


Catch ex As Exception
MsgBox(Err.Description)
End Try
End Function

0 comments

Post a Comment