[Mono-dev] SybaseDataAdapter.Fill NullReferenceException on Dispose()

armbrat jdavies at citco.com
Mon Jun 29 11:31:58 EDT 2009


Greetings,

I'm writing a simple data layer which communicates with a Sybase db.  Using
the Sybase ASE client, everything works, but when I switch to the Mono
Sybase client, I get a NullReferenceException in the
Mono.Data.SybaseClient.SybaseDataReader.Dispose(Boolean disposing) method.

The data is successfully loaded into the data table.  Wrapping the
SybaseDataAdapter.Fill method in a try/catch block squashes the exception,
but I'm concerned about its underlying cause.

Below is the method that is filling the table.  Does anyone have an idea
about what is causing this?

Regards,

Joe Davies

        public DataTable GetClient(string clientName)
        {
            DataTable table = new DataTable();

            using (SybaseConnection conn = new
SybaseConnection(this.ConnectionString))
            {
                string sqlQuery = @"SELECT * FROM client WHERE clientname =
@clientname";

                using (SybaseCommand cmd = new SybaseCommand(sqlQuery,
conn))
                {
                    cmd.Parameters.Add(new SybaseParameter("@clientname",
clientName));

                    using (SybaseDataAdapter adap = new
SybaseDataAdapter(cmd))
                    {
                        conn.Open();

                        try
                        {
                            adap.Fill(table);
                        }
                        catch
                        { }

                        conn.Close();
                    }
                }
            }

            return table;
        }
-- 
View this message in context: http://www.nabble.com/SybaseDataAdapter.Fill-NullReferenceException-on-Dispose%28%29-tp24256226p24256226.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list