1 Reply Latest reply on Apr 20, 2016 6:01 AM by coherentkris

    Accessing FileMaker Pro v6 database from C#

    Frosty33

      I am attempting to open and access a FileMaker Pro v6 database via C# and have been unable to establish a valid connection to the database - when executing, I receive the following error:

       

      ERROR [HY000] [FileMaker][ODBC FileMaker Pro driver][FileMaker Pro]Connect failed


      I have tried several variations of the code and have tried several variations of creating the ODBC DSN.


      Thought this would be an easy one. 


      If anyone has any step by step instructions on how to set this up, PLEASE pass them along.  I'm feeling like some of this (all of this?) issue is more related to the ODBC DSN set-up vs. code.


      Many thanks!!!


      Frosty

       

      Attempt #1

                      using (var conn = new OdbcConnection("dsn=MyFM;uid=user;pwd=xxx"))

                      {

                          conn.Open();

                          using (var cmd = conn.CreateCommand())

                          {

                              cmd.CommandText = "SELECT * FROM MyFM";

                              using (var reader = cmd.ExecuteReader())

       

                               ERROR

       

       

      Attempt #2

                  OdbcConnection conn = null;

                  OdbcCommand cmd = null;

                  OdbcDataReader dr = null;

       

                  string temp = "";

       

                  try

                  {

                      conn = new OdbcConnection("DSN=MyFM");

                      conn.Open();

                      cmd = new OdbcCommand("SELECT * FROM \"MyFM.fp5\"");

                      cmd.Connection = conn;

                      dr = cmd.ExecuteReader();

       

                      ERROR