Ошибка error not a table

I’m working on a C# application that reads/saves data in some old dbf-files.
(using Microsoft Visual FoxPro — driver)
I haven’t had any problems until recently, when i tried querying a table i had’nt used before and i got this error message. This table is somewhat special since it has 500+ columns, i suspect that this might have something to do with it — but nothing I’ve googled so far gives any indications to this causing any problems.

I’ve had a look at this document and checked that the header record count matches the actual count (1 record);
This document is the only good tip I’ve found so far, that does not require any heavy dbf-repair tools.

I’ve tried using both the Microsoft Visual FoxPro — and the VFPOLEDB driver, they both give more or less the same error message.

I’ve tried passing the TableValidate = 0 command, without success.

Does anybody have any experience with a way to solve/work around this, preferably using C#.

  • Remove From My Forums
  • Question

  • Here’s the problem I am having.

    It’s somewhat hard to describe this as not much detail is known about the .dbf file itself. Anyways….here’s what I know. With an OLEDB connection, I am trying to read/write to a .dbf file. Using a .dbf file viewer tool I am able to view the table structure
    of the file. However, when attempting to query the table programmatically I am getting an exception that the .dbf file is
    not a table. If this is the case, why am I able to view the table from the tool?

    I am, however, able to query tables in the same directory, but with a different version (as given by the tool), they are dbase III.

    Here is the code that I am using:

       OleDbConnection connection = null;
    
       OleDbDataReader reader = null;
    
       OleDbCommand command = null;
    
       
    
       try
    
       {
    
        string connectionString = "provider=vfpoledb.1; Data Source = y:\tableName.dbf"; //y is the table directory.
    
        connection = new OleDbConnection(connectionString);
    
    
    
        connection.Open();
    
    
    
        if (connection.State == ConnectionState.Open)
    
        {
    
         command = new OleDbCommand("", connection);
    
         command.CommandText = "Select * From tableName where fieldName = '" + txtCustNo.Text + "'";
    
         reader = command.ExecuteReader();
    
    
    
         if (reader.Read())
    
          lblCompany.Text = reader["fieldname"].ToString();
    
        }
    
        else
    
        {
    
         MessageBox.Show("Could not connect to database.");
    
         return;
    
        }
    
       }
    
       catch (Exception ex)
    
       {
    
    
    
       }
    
       finally
    
       {
    
        if (reader != null)
    
        {
    
         reader.Close();
    
         reader.Dispose();
    
        }
    
    
    
        if (command != null)
    
        {
    
         command.Dispose();
    
        }
    
    
    
        if (connection != null)
    
        {
    
         connection.Close();
    
         connection.Dispose();
    
        }
    
    
    
       }
    
    

    It’s not anything crazy, just wanting to show the code that I am using with the reference to the visual foxpro oledb provider.

    Any thoughts/suggestions would be greatly appreciated.

    Thanks in advance,

    Max

    • Edited by

      Wednesday, August 25, 2010 7:18 PM

Answers

  • I would write it like this (not related to error though):

    void Main()
    {
      string connectionString = 
        @"provider=vfpoledb;Data Source=y:";
      using(OleDbConnection connection = new OleDbConnection(connectionString))
      {
        connection.Open();
        if (connection.State == ConnectionState.Open)
    	{
    	 OleDbCommand command = connection.CreateCommand();
         command.CommandText = "Select * From tableName where fieldName = ?";
         command.Parameters.AddWithValue("p1",txtCustNo.Text);
         using(OleDbDataReader reader = command.ExecuteReader())
         {
          if (reader.Read()) 
          {
           Console.WriteLine ((string)reader["fieldName"]);
           }
    	   else
    	  {
    	   Console.WriteLine ("Could not connect to database.");
    	  }
         }
        }
      }
    }
    
    

    If it is saying it is not a table then check these:

    -It is a table but the header is corrupt. Fix it.

    -It is really not a table

    -It is a table with some fields that older VFPOLEDB doesn’t recognize (ie: you are using version 7 VFPOLEDB driver and the table has a blob field). Be sure you are using version 9.

    • Marked as answer by
      Martin_Xie
      Monday, September 6, 2010 9:31 AM

  • Cetin, neither your values nor the VFP help is correct:

    File type: 0x01

    FoxBASE: 0x02

    FoxBASE+/Dbase III plus, no memo: 0x2F

    Visual FoxPro: 0x30

    Visual FoxPro, autoincrement enabled: 0x31

    Visual FoxPro, Varchar, Varbinary, or Blob-enabled: 0x42

    dBASE IV SQL table files, no memo: 0x62

    dBASE IV SQL system files, no memo: 0x82

    FoxBASE+/dBASE III PLUS, with memo: 0x8A

    dBASE IV with memo: 0xCA

    dBASE IV SQL table files, with memo: 0xF4

    FoxPro 2.x (or earlier) with memo: 0xFA

    The link from Naom’s post is more accurate.

    And you can try it in Hex edit.

    You are sort of right. The help was wrong, as well as yours:) Foxpro 2.x with memo have 0xF5 (checked with hexedit).

    Then that means header is corrupt.

    • Marked as answer by
      Martin_Xie
      Monday, September 6, 2010 9:30 AM

INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Thanks. We have received your request and will respond promptly.

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It’s Free!

*Tek-Tips’s functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Foxpro error «Not a Table» ?

Foxpro error «Not a Table» ?

(OP)

12 Feb 02 14:41

Hi,
I have got a data file (file.dbf) and when I try to open it using MS Visual Foxpro I get an error «Not a table».. Suspecting the file got corrupted…  However I can read the data from this file using some «DBFREADER» program.

Am I missing the .CRX ? or Is there any way I can repair this file ?  Thanks

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Join Tek-Tips® Today!

Join your peers on the Internet’s largest technical computer professional community.
It’s easy to join and it’s free.

Here’s Why Members Love Tek-Tips Forums:

  • Tek-Tips ForumsTalk To Other Members
  • Notification Of Responses To Questions
  • Favorite Forums One Click Access
  • Keyword Search Of All Posts, And More…

Register now while it’s still free!

Already a member? Close this window and log in.

Join Us             Close

Comments

@KR411-prog

arianvp

added a commit
to arianvp/charts
that referenced
this issue

Nov 18, 2020

@arianvp

Otherwise helm will log:
```
coalesce.go:160: warning: skipped value for environment: Not a table.
coalesce.go:160: warning: skipped value for environment: Not a table.
coalesce.go:160: warning: skipped value for environment: Not a table
```

when overriding this value.

See helm/helm#8283

Knappek

added a commit
to prometheus-msteams/prometheus-msteams
that referenced
this issue

Nov 22, 2020

@Knappek

Otherwise helm will log:

```
coalesce.go:160: warning: skipped value for environment: Not a table.
```

when overriding this value.

See helm/helm#8283

Knappek

added a commit
to prometheus-msteams/prometheus-msteams
that referenced
this issue

Nov 22, 2020

@Knappek

Otherwise helm will log:

```
coalesce.go:160: warning: skipped value for environment: Not a table.
```

when overriding this value.

See helm/helm#8283

Knappek

added a commit
to prometheus-msteams/prometheus-msteams
that referenced
this issue

Mar 5, 2021

@Knappek

Otherwise helm will log:

```
coalesce.go:160: warning: skipped value for environment: Not a table.
```

when overriding this value.

See helm/helm#8283

I need help with an ajax call I am performing, I am passing back an array from the backend as seen below, if I alert the data on the front end I get this.

However when I pass it through, google charts tells me it’s not an array.

Uncaught Error: Not an array
    at gvjs_oba (format+en_GB,default+en_GB,ui+en_GB,corechart+en_GB.I.js:272)
    at new gvjs_Pl (format+en_GB,default+en_GB,ui+en_GB,corechart+en_GB.I.js:274)
    at drawChart (Default.aspx:60)
    at Object.success (Default.aspx:43)
    at j (jquery-1.11.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-1.11.1.min.js:2)
    at x (jquery-1.11.1.min.js:4)
    at b (jquery-1.11.1.min.js:4)
    at Object.send (jquery-1.11.1.min.js:4)
    at Function.ajax (jquery-1.11.1.min.js:4)

Ajax Query

<script lang="javascript">

        var chart_data;
        var startdate = "default";
        var enddate = "default";
        google.load("visualization", "1", {packages:["corechart"]});
        google.setOnLoadCallback(load_page_data);

        function load_page_data()
        {
            $.ajax({
                type: "post",
                url: 'feed.aspx/GetJsonwithStringBuilder',
                data: JSON.stringify({y: $('input[name=yaxis]:checked').val()}),
                contentType: "application/json; charset=utf-8",
                dataType: "text",
                async: false,
                success: function (data) {
                    if (data) {
                    drawChart(data, "My Chart", "Members");
                    }

                },
                error: function () {
                    alert('error');
                }
        });
        }

        function drawChart(chart_data, chart1_main_title, chart1_vaxis_title) {
            var chart1_data = new google.visualization.arrayToDataTable(chart_data);
            var chart1_options = {
                title: chart1_main_title,
                hAxis: { title: 'Month', type: 'string' },
                seriesType: 'bars',
                vAxis: { title: chart1_vaxis_title, titleTextStyle: { color: 'red' } }
            };

            var chart1_chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
            chart1_chart.draw(chart1_data, chart1_options);
        }
        </script>

This is the backend

 [WebMethod()]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string GetJsonwithStringBuilder(string y)
{
    DataTable dsChartData = new DataTable();
    StringBuilder strScript = new StringBuilder();

    try
    {
        dsChartData = GetChartData();

        strScript.Append("[[");

        foreach (DataColumn column in dsChartData.Columns)
        {
            strScript.Append(""" + column.ColumnName + "",");
        }

        strScript.Remove(strScript.Length - 1, 1);
        strScript.Append("],");

        foreach (DataRow row in dsChartData.Rows)
        {
            strScript.Append("[");
            foreach (DataColumn column in dsChartData.Columns)
                if (column.ColumnName == "Month")
                    strScript.Append(""" + CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(Int32.Parse(row[column.ColumnName].ToString())) + "",");
                else if (IsNumber(row[column.ColumnName].ToString()))
                    strScript.Append("" + row[column.ColumnName] + ",");
                else
                    strScript.Append(""" + row[column.ColumnName] + "",");

            strScript.Remove(strScript.Length - 1, 1);
            strScript.Append("],");
        }

        strScript.Remove(strScript.Length - 1, 1);
        strScript.Append("]");
        return strScript.ToString();
    }
    catch (Exception ex)
    {

    }
    finally
    {
        dsChartData.Dispose();
        strScript.Clear();
    }

    return "";
}


You need to use data.d instead of data in success function

$.ajax({
     type: "post",
     url: 'feed.aspx/GetJsonwithStringBuilder',
     data: JSON.stringify({y: $('input[name=yaxis]:checked').val()}),
     contentType: "application/json; charset=utf-8",
     dataType: "json",
     async: false,
     success: function (data) {
          var dataObj=JSON.parse(data.d);
          if (dataObj) {
             drawChart(dataObj, "My Chart", "Members");
          }
      },
      error: function () {
         alert('error');
      }
});

Понравилась статья? Поделить с друзьями:
  • Ошибка esp kia ceed 2011
  • Ошибка error model bind подключения телевизор самсунг
  • Ошибка esp на opel insignia
  • Ошибка esp мерседес w211 что она означает
  • Ошибка error loading python dll