DataTable Source and Name property question

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

DataTable Source and Name property question

Post by degas » Wed 24 Nov 2010 18:07

I have a simply DataTable that was generated with DevArt wizard. Then i changed the Name property on the DataTable, but maintain the Source value.

Using the following code

....
OracleDataAdapter adapter = new OracleDataAdapter();
OracleCommandBuilder comdBuilder = new OracleCommandBuilder(adapter);
adapter.SelectCommand = mails.SelectCommand;
adapter.Update(mails);
....


where mails is the DataTable that i mentioned above. The error i get say "Missing DataColumn 'ID_MAIL' in DataTable 'Mail' for Source Column 'ID_MAIL'. This error is because i changed the name of the column ID_MAIL to IdMail. If i change it back, everything works fine.

My question is, if it is possible to change the Name property. This would be great, because, it allows me to make the code more readable.
Thanks

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Wed 24 Nov 2010 18:09

I can change it from ID_MAIL to Id_Mail, but not to IdMail. So the mapping is not case sensitive

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 26 Nov 2010 15:42

Column mappings in DataSet can be set on the 4th step of Devart DataSet Wizard. Please tell us the steps we should follow to reproduce the problem. Also specify the version (x.xx.xxx) of your dotConnect for Oracle. You can find it in the Tools > Oracle > About menu of Visual Studio.

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Mon 29 Nov 2010 13:38

The version i am using is 5.20.33.
As an example.
Suppose you have a table A with 2 columns COLUMN_A and COLUMNB.
The first one has an underscore and the second one doesn't.
When using the DataSet wizard, i want to name the columns, ColumnA and ColumnB, so that the datatable has the properties with those names.
After i generate the datatable i run some test. When i add a row, the insert command generated is wrong, and for ColumnA, it always send a null value.
I i rename the property Column_A, it works fine

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Mon 29 Nov 2010 14:08

I have found a temporary solution. After generating the datatable, i have to manually update the Insert/Update parameter collection, so that the parameter that corresponds to the ColoumnA, must have the SourceColumn property set to ColumnA (the oroginal value is COLUMN_A). This is why it always set null, because i does not match the command with the datatable column name.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 01 Dec 2010 13:53

I still cannot reproduce the issue. Here are the steps I have followed (with Visual Studio 2008):
1) installed dotConnect for Oracle v 5.20.33 Professional;
2) executed this script in my Oracle Server 11R2 database:

Code: Select all

CREATE TABLE AB (
  COLUMN_A NUMBER(38),
  COLUMNB NUMBER(38));
3) ran DataSet Wizard (Tools > Oracle > DataSet Wizard) in my project and changed DataSet Column COLUMN_A --> COLUMNA on the 4th step;
4) executed the following code successfully (row was inserted into table in the database):

Code: Select all

    DataSet1.ABRow row = dataSet11.AB.NewABRow();
    row[0] = 1;
    row[1] = 1;
    dataSet11.AB.AddABRow(row);
    dataSet11.Update();
The row object contains 2 properties: COLUMNA and COLUMNB. The COLUMN_A parameter of insert command's parameters collection of my ABTableAdapter contains SourceColumn=COLUMN_A.

Please tell us what should be changed in the above steps to reproduce the problem with the NULL value. You have found out that COLUMN_A parameter's value is NULL from dbMonitor, haven't you?

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Mon 06 Dec 2010 13:53

Yes, you are rigth, but when editing out of the DataSetWizard , directly from de DataSet designer, it does not generate the commands properly.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 08 Dec 2010 16:53

I have generated a DataSet with the AB table (left all default names unchanged). Then changed the Name property of the COLUMN_A data column in MS DataSet Designer: COLUMN_A --> COLUMNA. In this case the following code runs successfully with the 5.20.33 version:

Code: Select all

            DataSet1 ds = new DataSet1();
            ds.Connection = new Devart.Data.Oracle.OracleConnection("server=orcl1120;uid=scott;pwd=tiger;");
            DataSet1.ABRow row = ds.AB.NewABRow();
            row["COLUMNA"] = 13;
            row["COLUMNB"] = 1;
            ds.AB.AddABRow(row);
            ds.Update();

Post Reply