sql - Foxpro: Check whether table exists via vfpoledb -


I have the data in .dbf files via System.Data.OleDb (vfpoledb.dll) I use How can I find that the table exists through the SQL command? Something similar to the following on the SQL server:

  if (for information from Symmettable Tabletable = 'The Telebill' by XISTS) BEGIN - Do Stuff End  

If you have a DBC file then you can ask whether the table exists or not.

  string dbc = "northwind.dbc"; (Using OleDbConnection conn = new OleDbConnection (connectionString)) {DataTable dt = New DataTable (); String sql = string.format (@ "SELECT * FROM {0} where alltreme = 'table' and upper (alltreme (objectname)) = '{1}'", DBC, tablename. Toopper ()); OleDbDataAdapter da = New OleDbDataAdapter (sql, conn); Da.Fill (DT); Bool tableExists = dt! = Null & amp; Amp; Dt.Rows.Count == 1; }  

But in reality you do not need a SQL command or a DBC file to get that information. You can get it directly from OleDbConnection using the GetSchema method.

 using  (OleDbConnection conn = new OleDbConnection (connectionString)) {conn.Open (); DataTable Table = conn.GetSchema ("Tables"); Conn.Close (); Var tableExists = (From the row in tables. ANNemreable ()) where the row.field is & lt; String & gt; Select the row ("Table_Name") equals (TapName, String Compression.Content Culture Igniter Seas). Field & lt; String & gt; ("Table_Name")). FirstOrDefault ()! = Null; }  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -