AnsweredAssumed Answered

System.Data.Odbc.OdbcErrorCollection when working on FileMaker pro

Question asked by FanYang on Apr 30, 2015
Latest reply on May 1, 2015 by FanYang

Title

System.Data.Odbc.OdbcErrorCollection when working on FileMaker pro

Post

I am working on an application to get data from FileMaker pro, based on the document: The ODBC client driver supports the following Catalog functions: 1 SQLTables - catalog information is stored and reported as single part names (table name only).

I tested the following code but got an exception called System.Data.Odbc.OdbcErrorCollection:

conn = new OdbcConnection("DSN=FileMaker;Uid=Admin;Pwd=123456");
conn.Open();

cmd = new OdbcCommand("SELECT * FROM SimpleProductTest");
cmd.Connection = conn;
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
if ((dr != null) && (dr.HasRows))
{
 while (dr.Read())
 {
         temp = dr.GetString(0);
         Console.WriteLine(temp);
 }
}
DataTable dt = conn.GetSchema("Tables");
Console.WriteLine("Done.");
Console.ReadLine();

The stack trace:

*at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)

at System.Data.Odbc.OdbcDataReader.GetColAttribute(Int32 iColumn, SQL_DESC v3FieldId, SQL_COLUMN v2FieldId, HANDLER handler)

at System.Data.Odbc.OdbcDataReader.BuildMetaDataInfo()

at System.Data.Odbc.OdbcDataReader.GetSchemaTable()

at System.Data.Odbc.OdbcMetaDataFactory.NewDataTableFromReader(IDataReader reader, Object[]& values, String tableName)

at System.Data.Odbc.OdbcMetaDataFactory.DataTableFromDataReader(IDataReader reader, String tableName)

at System.Data.Odbc.OdbcMetaDataFactory.GetTablesCollection(String[] restrictions, OdbcConnection connection, Boolean isTables)

at System.Data.Odbc.OdbcMetaDataFactory.PrepareCollection(String collectionName, String[] restrictions, DbConnection connection)

at System.Data.ProviderBase.DbMetaDataFactory.GetSchema(DbConnection connection, String collectionName, String[] restrictions)

at System.Data.ProviderBase.DbConnectionInternal.GetSchema (DbConnectionFactory factory, DbConnectionPoolGroup poolGroup, DbConnection outerConnection, String collectionName, String[] restrictions)

at System.Data.Odbc.OdbcConnection.GetSchema(String collectionName, String[] restrictionValues)

at VizSeekApp.DbMapForm.button1_Click(Object sender, EventArgs e) in C:\FrontEndProjects_new\WindowsDesktopApp\VizSeekApp\VizSeekApp\DbMapForm.cs:line 335*

The inner exception and error message are empty.

I did research about System.Data.Odbc.OdbcErrorCollection, but no luck. Also I tested this piece of code with MySql ODBC, which works well, it means that my code may not have problems. Anyone find a problem? Thanks in advance.

Outcomes