[ http://tracker.firebirdsql.org/browse/DNET-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jiri Cincura reopened DNET-288: ------------------------------- Actually it looks easy to improve this to support scenario when no datatype is set explicitly by developer, to just go to database and ask for it. Look at DNET-289. > TimeSpan FbCommand parameter throws InvalidCastException with embedded FB > ------------------------------------------------------------------------- > > Key: DNET-288 > URL: http://tracker.firebirdsql.org/browse/DNET-288 > Project: .NET Data provider > Issue Type: Bug > Components: ADO.NET Provider > Affects Versions: 2.5.1 > Environment: Windows, Firebird 2.1.2, Firebird embedded 2.1.3.18185, > Firebird .net provider 2.5.1.0 > Reporter: Pavel Kopecky > Assignee: Jiri Cincura > Priority: Minor > > I have a method parameter 'time' of type nullable<TimeSpan>. When I use it > with Firebird 2.1.2, everything is ok, with Firebird embedded I get > InvalidCastException. > This is part of my SQL command: > if (time.HasValue) > sqlText.AppendLine(" AND time_from_t19 <= @time and time_to_t19 >= > @time"); > (...) > if (time.HasValue) > command.Parameters.AddWithValue("time", time.Value); > Exception: > Type: InvalidCastException > Message: Unable to cast object of type 'System.TimeSpan' to type > 'System.Byte[]'. > Source: XXXXXXXX.DBLayer > Target site: FirebirdSql.Data.FirebirdClient.FbDataReader > ExecuteReader(FirebirdSql.Data.FirebirdClient.FbCommand) > When I use this instead, everything is ok: > if (time.HasValue) > sqlText.AppendLine(" AND time_from_t19 <= '" + time.Value.ToString() + "' > and time_to_t19 >= '" + time.Value.ToString() + "'"); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider