Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FbParameter does not support DbType.DateTimeOffset #1189

Open
ig-sinicyn opened this issue Sep 3, 2024 · 1 comment
Open

FbParameter does not support DbType.DateTimeOffset #1189

ig-sinicyn opened this issue Sep 3, 2024 · 1 comment

Comments

@ig-sinicyn
Copy link

FirebirdSql.Data.FirebirdClient v10.3.1.

I have a Dapper query that attempts to insert a DateTimeOffset value but fails with ArgumentException: "Invalid data type: 27.".
Simplified version:

        var connectionString = "...";

        var connection = new FbConnection(connectionString);
        await connection.QueryFirstAsync<DateTimeOffset>(
            "select cast(@value as timestamp) from rdb$database",
            new { Value = DateTimeOffset.UtcNow });

I've debugged the code and it looks like FbParameter.DbType property does not accept DateTimeOffset value.

        var param = new FbParameter()
        {
            DbType = DbType.DateTimeOffset // ArgumentException here
        };

As a workaround I've used DateTime values but it will be much better to have DateTimeOffsert params to work out of the box.

@cincuranet
Copy link
Member

If you want to work with time zones, you should use FbZonedDateTime which is more aligned to how time zones are handled in Firebird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants