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

FbDataAdapter doesn't fill MaxLength-Property of DataColumn of varchar type [DNET1039] #950

Closed
firebird-automations opened this issue Apr 8, 2021 · 1 comment

Comments

@firebird-automations
Copy link

Submitted by: Baldur Fürchau (bfuerchau)

In the previous used Version 6.8.0.0 the fbDataAdapter Fill-Method create string columns correct with MaxLength-Property.
Now in 7.10.1.0 the MaxLength is always -1!

Workaround:
To solve the problem i must now load the columns schema to set the property by myself.

             DataTable xTable = new DataTable\(\);
             using \(DbCommand xCommand = GetCommand\(xConnection, sql\)\)
                \{
                    using \(DbDataAdapter adapter = new FbDataAdapter\(xCommand as FbCommand\)\) 
                    \{
                        adapter\.Fill\(xTable\);
                    \}
                \}

I must du this in all my applications because the 7.10 is faster than 6.8 and i need the fastest version for a datawarehouse.

@cincuranet
Copy link
Member

Version 6.8.0.0 does not exist. Closest is probably 6.7.0.0. And using the code below gives me -1 on 6.7.0.0 as well as 8.5.0.0.

using var conn = new FbConnection("database=localhost:test.fdb;user=sysdba;password=masterkey");
var table = new DataTable();
using var cmd = conn.CreateCommand();
cmd.CommandText = "select cast('aaa' as varchar(20)) from rdb$database";
using var adapter = new FbDataAdapter(cmd);
adapter.Fill(table);
Console.WriteLine(table.Columns[0].MaxLength);

If proper example code is provided I'll reopen.

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