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
FbCommandBuilder has problems with Calculated fields [DNET100] #112
Comments
Commented by: @cincuranet Carlos, this column should be set as read-only, for this case: ds.Tables["Contacts"].Columns[2].ReadOnly = true; I'm trying to find some fix. |
Commented by: @carlosga Sure, i will try to review the FbDataReader.GetSchemaTable implementation as soon as possible |
Commented by: @cincuranet SchemaTable is OK. The 3rd column is marked as read-only. |
Commented by: @carlosga So the DbCommanBuilder class so triying to generate parameters for all columns without checking if they are readonly or not ?? huummmm |
Commented by: @carlosga What is the value of the IsExpression column returned by the GetSchemaTable ?? |
Commented by: @cincuranet It's false. Maybe the problem. |
Commented by: @cincuranet OK, we've got a problem. The IsExpression method from DbField.cs is not saying true. It's getting result, whether is expression or not from length of Name property. This isn't good, because every column in FB has some name. We should look into RDB$COMPUTED_SOURCE. I'll try to find the solution ASAP. |
Commented by: @carlosga But it comes as empty for fields that aren't part of the table, if i remember well ( while i agree the way it's done isn't the best ;) ) So we can modify the select used to get the information in GetSchemaTable to fetch the RDB$COMPUTED_SOURCE and check it this friday ( haven't .net installed right now ) |
Commented by: @cincuranet I'll send you e-mail with aditional info to not spam tracker. |
Modified by: @cincuranetassignee: Carlos Guzman Alvarez [ carlosga_fb ] => Jiri Cincura [ cincura_net ] |
Modified by: @cincuranetstatus: Open [ 1 ] => In Progress [ 3 ] |
Commented by: Eduardo Gamboa (bestrafender) Hi Guys, I just want to know if this change has been submitted to SVN? Thanks in advance |
Commented by: @cincuranet 306 should be OK. When I run your code, it's ok, no exception. Did you rebuild you application to use new version of provider? And are you referencing right file? |
Commented by: Eduardo Gamboa (bestrafender) Yes, I re-built my app, and I am sure I am referencing the new assembly because a can verify the change for DNET90 I reported earlier. |
Commented by: @cincuranet Send to my email (mailto:jiri@cincura.net) sample app. I'll review this. |
Commented by: @cincuranet I have tested your case here you put. Just Cut'n'Paste and fresh build of provider and it works. You're probably referencing wrong assembly. |
Commented by: @cincuranet I got the testapp. You're not referencing new assembly. You have <Reference Include="FirebirdSql.Data.FirebirdClient, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL" /> |
Commented by: Eduardo Gamboa (bestrafender) Sorry, My bad, I was using the NetProvider_210 branch instead of the trunk. Now the calculate-field problem is fixed, but a new problem surfaced. DataSet ds = new DataSet(); but now it throws the exception: Object reference not set to an instance of an object. Should I open a new bug report for this? |
Commented by: @cincuranet 'Cause you don't provide test case, it's hard to decide whether and where is the problem. Create new ticket and there post testcase. I'll look at it. |
Modified by: @cincuranetstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Eduardo Gamboa (bestrafender)
When I try to insert new rows using FbDataAdapter and FbCommandBuilder an exception is thrown when the table has calculated fields.(e.g)
/****************************************/
CREATE TABLE CONTACTS (
FIRST_NAME VARCHAR(32) NOT NULL,
LAST_NAME VARCHAR(32),
FULL_NAME COMPUTED BY (FIRST_NAME ||' '|| LAST_NAME)
);
/****************************************/
using System;
using System.Collections.Generic;
using System.Text;
using FirebirdSql.Data.FirebirdClient;
using System.Data;
namespace FBCommanBuilderTest
{
class Program
{
static void Main(string[] args)
{
try
{
FbConnectionStringBuilder fbCsb = new FbConnectionStringBuilder();
fbCsb.Dialect = 3;
fbCsb.UserID = "SYSDBA";
fbCsb.Password = "masterkey";
fbCsb.Database = @"localhost:d:\my projects\firebird databases\test.fdb";
FbConnection fbConn = new FbConnection(fbCsb.ConnectionString);
fbConn.Open();
string strCmd = "SELECT * FROM \"CONTACTS\"";
FbDataAdapter fbDA = new FbDataAdapter(strCmd, fbConn);
FbCommandBuilder fbCB = new FbCommandBuilder(fbDA);
DataSet ds = new DataSet();
fbDA.Fill(ds, "Contacts");
object[] values = new object[3];
values[0] = "EDUARDO";
values[1] = "GAMBOA";
values[2] = "DUMMY VALUE";
ds.Tables["Contacts"].Rows.Add(values);
fbDA.Update(ds.Tables["Contacts"]);
fbConn.Close();
Console.WriteLine("Ok.");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine("Error:");
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
}
Commits: 2a981a5 cef6739
The text was updated successfully, but these errors were encountered: