Firebird embedded "Specified cast is not valid"

Posts   
 
    
sherman
User
Posts: 9
Joined: 31-Jul-2007
# Posted on: 21-Jul-2009 17:51:50   

Hi!, when I try to run my app with Firebird Embedded I receive: "Specified cast is not valid." Everything it's ok with Firebird Client/server.

The problem is with Decimal fields (NUMERIC(15,0) in the database)


CuentaEntity cuenta = new CuentaEntity(id);
adapter.FetchEntity(cuenta);
MessageBox.Show(cuenta.Numero.ToString()); // ok, string field with the correct value
MessageBox.Show(cuenta.Icono.ToString()); // ok, int field with the correct value
MessageBox.Show(cuenta.IdCuenta.ToString()); // decimal field (PK) -> exception "Specified cast is not valid."

Can you help me?


System.InvalidCastException was unhandled
  Message="Specified cast is not valid."
  Source="Microserver.Integrador.DAL"
  StackTrace:
       at Microserver.Integrador.DAL.EntityClasses.CuentaEntity.get_IdBanco() in P:\UnicajaIntegradorCuentas\Fuentes\Integrador\Microserver.Integrador.DAL\EntityClasses\CuentaEntity.cs:line 1023
       at Microserver.Integrador.GUI.Helpers.CuentaHelper.TooltipCuenta(Decimal idCuenta) in P:\UnicajaIntegradorCuentas\Fuentes\Integrador\Integrador\Helpers\CuentaHelper.cs:line 29
       at Microserver.Integrador.GUI.MainMenuForm.RefrescarTagCloud() in P:\UnicajaIntegradorCuentas\Fuentes\Integrador\Integrador\MainMenuForm.cs:line 51
       at Microserver.Integrador.GUI.MainMenuForm..ctor() in P:\UnicajaIntegradorCuentas\Fuentes\Integrador\Integrador\MainMenuForm.cs:line 33
       at Microserver.Integrador.GUI.Program.Main() in P:\UnicajaIntegradorCuentas\Fuentes\Integrador\Integrador\Program.cs:line 29
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Environment: LLBLGen 2.6 - September 12th, 2008 C# - Adapter - .NET 2.0 Firebird 2.1

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 21-Jul-2009 21:44:39   

This thread deals with a similar issue.

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 21-Jul-2009 22:15:06   

The ado.net provider returned it as a different type for embedded it seems. Do you use the latest firebird embedded dll? What type is it returned as? Also, please notify the firebird provider people about this, as it might be a bug on their side (as in: the type should be returned as the same .net type as with normal firebird.)

Frans Bouma | Lead developer LLBLGen Pro