2012-04-25 12:57
浏览 67


I am attempting to read a foxpro table called SCHEDULE.dbf. The data is read in PHP via data connector then piped to my webpage. This all works wonderfully, provided I rename Schedule.dbf. Any name except Schedule seems to work. When I run it named Schedule, however, I get "SQL error: [Microsoft][ODBC dBase Driver] Index file not found., SQL state S0012 in SQLExecDirect" error message. My only idea is that Schedule is a reserved word someplace, but I can't find it on any list. I am at an utter loss. Renaming the table is not really an option as it is part of a larger data entry and management system that I would rather not modify. Any suggestions?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试读取名为SCHEDULE.dbf的foxpro表。 数据通过数据连接器在PHP中读取,然后通过管道传输到我的网页。 如果我重命名Schedule.dbf,这一切都很有效。 除了Schedule之外的任何名称似乎都有效。 然而,当我运行名为Schedule时,我得到“SQL错误:[Microsoft] [ODBC dBase Driver]索引文件未找到。,SQLExecDirect中的SQL状态S0012”错误消息。 我唯一的想法是,Schedule在某个地方是一个保留字,但我无法在任何列表中找到它。 我完全失去了。 重命名表并不是一个选项,因为它是更大的数据输入和管理系统的一部分,我宁愿不修改。 有什么建议吗?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongrong7267 2012-04-25 15:22

    I can't say for dBASE (and I would use Microsoft's OleDb provider specifically for VFP if it IS Foxpro data and not dBASE). In Foxpro, the system works with paired (or even triple) files. All corresponding file names need to be renamed, such as

    SCHEDULE.DBF (main data)
    SCHEDULE.CDX (compound index file for all indexes for given file)
    SCHEDULE.FPT (separate file if any memo/general data columns in the file)

    If you try to just rename the .DBF but not the rest (.FPT is only found IF a data column is of type memo or general), then it will choke opening the file.

    Additionally. If the table is part of a database container (via VFP), and you try to open it, the file has additional header information to point to the database it is bound to. If it can't find it in the database, that too could give you a misdirected error.

    Database Containers in VFP have suffix values of .DBC, .DCT and .DCX.

    打赏 评论
  • du9826 2012-04-25 13:41

    The error is "Index file not found" - The matching .cdx index file is not present in the same directory as the .dbf file. Make sure it is in the same directory or you can use FoxPro to remove the index from the table.

    打赏 评论

相关推荐 更多相似问题