Datatable missing column when import to datagrid!

Please try with the sample file, as I said in some previous posts, I will lose the column if its first row of data doesn't contain value,
here is the picture I describe and the data in the datagrid!



in sfdatagrid


When converting from datatable to dynamic datatable: (still 6 columns)



but in sf_DataGrid1_AutoGeneratingColumn event! only 5 columns generated!
am i missing something ?

'----------------------------------------------------------------------------------------------
if I keep the datatable (not dynamic) everything is fine


from my code:

constring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & mypath & "';Extended Properties='Excel 12.0 Xml;" & hdr & ";IMEX=1;'"

Dim p_sqlAdapter As OleDbDataAdapter = New OleDbDataAdapter(vbNullString, New OleDbConnection(constring))

                                                  p_sqlAdapter.SelectCommand.CommandText = “select * from namerange”

                                                  Dim ds As DataSet = New DataSet("datasetname")

                                                  p_sqlAdapter.Fill(ds)

                                                  p_Datatable = ds.Tables(0)


Attachment: Test__c029737.rar

16 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team September 17, 2020 12:29 PM UTC

Hi Khanh Dang,

Thank you for contactring Syncfusion support.

Currently, we are analyzing your requirement of “Datatable missing column when import to datagrid”. We will validate and update you the details on or before September 21, 2020. 
 
We appreciate your patience until then. 
 
Regards, 
Vijayarasan S 



VS Vijayarasan Sivanandham Syncfusion Team September 22, 2020 03:30 AM UTC

Hi Khanh Dang,

Thank you for your patience.

We can able to reproduce your reported issue “Datatable missing column when import to datagrid” from our end. We have considered this issue as bug. But In this missing column we have get the type as DBNull. we cannot predict the type of DBNull in column. So, we have generated the DBNull type as String type column. If you need to change the type of column. This can be achieved by using SfDataGrid.AutoGeneratingColumn event.

Please let us know, this is enough for you scenario.
   
Regards,   
Vijayarasan S

 



TG The GridLock September 22, 2020 02:14 PM UTC

Hi Vijayarasan ,
when I convert from datatable to dynamic datatable I checked and reassigned this dbnull value (based on the column's datatype)
if string:     reassign dbnull by "" or string.empty
if numeric: reassign dbnull by nothing or null
At this point the dynamic datatable no longer exists dbnull values
but like I said. after assigning:
sfdatagrid.datasouce = thisdynamicdatatable
That column still doesn't appear. (in the autoGeneratingColumn event only 5 columns appear instead of 6)
Notes: if I change value of 2nd cell from "" to " " or "-" as long as it's not empty then this column will be generate!


VS Vijayarasan Sivanandham Syncfusion Team September 23, 2020 10:17 AM UTC

Hi Khanh Dang,

Thanks for the update.

Based on the provided information DynamicDataTable set as DataSource for SfDataGrid when the column not generating for DBNull Property type. In this case, Column not created and not showed in SfDataGrid.AutoGeneratingColumn event.

So, we have considered this issue as a bug. We cannot predict the type of DBNull in the column. So, we have generated the DBNull type as String type column. After fixing this issue column will appear in SfDataGrid.AutoGeneratingColumn event. In case you need to change the type of column. This can be achieved by using SfDataGrid.AutoGeneratingColumn event.
 
 
Can you please confirm, which version you are using currently?

It will be helpful for us to provide patch in that version.

Regards,
Vijayarasan S 



TG The GridLock September 23, 2020 03:02 PM UTC

Hi Vijayarasan ,
I am using version 18.1.042.
Obviously the column should be added. This is what I expected.
Thank you!


VS Vijayarasan Sivanandham Syncfusion Team September 24, 2020 11:16 AM UTC

Hi Khanh Dang,

Thanks for the update.


We have created bug report for the reported issue “DynamicDataTable set as DataSource for SfDataGrid when the column not generating for DBNull Property type”. We will fix this issue and provide you with patch on October 08, 2020.

You can track the status of this report through the following feedback link,

Feedback link: https://www.syncfusion.com/feedback/18191/dynamicdatatable-set-as-datasource-for-sfdatagrid-when-the-column-not-generating

Note: The provider feedback link is private, and you need to login to view this feedback.

We appreciate your patience until then.

Regards,
Vijayarasan S 



VS Vijayarasan Sivanandham Syncfusion Team October 8, 2020 04:10 PM UTC

Hi Khanh Dang,

Thank you for your patience.

We have fixed the issue “
DynamicDataTable set as DataSource for SfDataGrid when the column not generating for DBNull Property type” and you can download the patch from following location.

v18.1.0.42
 
Recommended approach – exe will perform automatic configuration       
Please find the patch setup here:   

 

Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment                       
 
Please find the patch assemblies alone from: 

 
  
Please find the NuGet’s from the below location: 

 
 
  
Assembly Version: 18.1.0.42 
Installation Directions:  
This patch should replace the files files “Syncfusion.Data.Winforms” and “Syncfusion.SfDataGrid.Winforms”  under the following folder.  
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\4.0  
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\18.1.0.42\precompiledassemblies\18.1.0.42 \4.0  
   
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location, or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies. 

FeedBack Link: https://www.syncfusion.com/feedback/18191/dynamicdatatable-set-as-datasource-for-sfdatagrid-when-the-column-not-generating

 
Note:  
To change how you receive bug fixes, ask your license management portal admin to change your project’s patch delivery mode.  
   
   
Disclaimer:  
If you have received other patches for the same version for other products, please apply all patches in the order received. Please note that we have created this patch for version 18.1.0.42 specifically to resolve the following issue reported in the forum 157918.  
 
Regards, 
Vijayarasan S 


Marked as answer

TG The GridLock October 9, 2020 08:58 AM UTC

Ok Vijayarasan,
Good news with me now!


VS Vijayarasan Sivanandham Syncfusion Team October 9, 2020 09:07 AM UTC

Hi Khanh Dang, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊. 
 
Regards, 
Vijayarasan S 
 



TG The GridLock October 12, 2020 06:38 AM UTC

Hi Vijayarasan,
more question:
Is there any reason make my column's name to change? (dot -> #)
.



VS Vijayarasan Sivanandham Syncfusion Team October 13, 2020 12:03 PM UTC

Hi Khanh Dang,

Thanks for the update. 
 
We have checked the reported issue “Column header text change dot from # in SfDataGrid” and unable to replicate the issue from our end. it is working fine as expected. Please find the tested sample and video demo from our end in the below link,
   

Video Link:
https://www.syncfusion.com/downloads/support/forum/157918/ze/HeadetTextDot1053595707

We have checked with Syncfusion product version 18.1.0.42.

Can you please share us below things?
       
        1. Brief replication procedure/video illustration of the reported issue
        2. Code snippet related to customization in SfDataGrid 
       
if you still facing the same issue? If yes, please modify the sample based on your scenario.  
   
It will be helpful for us to check on it and provide you the solution at the earliest.     
   
Regards,   
Vijayarasan S 



TG The GridLock October 17, 2020 05:30 AM UTC

hi Vijayarasan ,
i found the problem here, maybe i will find a way to solve it.



VS Vijayarasan Sivanandham Syncfusion Team October 19, 2020 11:17 AM UTC

Hi Khanh Dang,

 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊. 
 
Regards, 
Vijayarasan S 



VS Vijayarasan Sivanandham Syncfusion Team November 3, 2020 08:19 AM UTC

Hi Khanh Dang,

Please ignore the previously provided patch.

DbNull type is specifically used to denote the empty value or null value in Database such as DataTable. Since we passed the DbNull value in the ExpandoObject, sorting and other data operations will not be worked by default. So, the recommended way would be converting the DbNull values to the null value when assign to ExpandoObject at sample level. Your reported issue is fixed in sample level. Please refer the below code snippet for your reference, 
foreach (System.Data.DataRow row in collection.Rows) 
    ExpandoObject expandoObject = new ExpandoObject(); 
    dynamicCollection.Add(expandoObject); 
    foreach (DataColumn column in collection.Columns) 
    { 
        var dictionary = ((IDictionary<string, object>)(expandoObject)); 
        dictionary[column.ColumnName] = row[column] is DBNull ? null : row[column]; 
    } 
 
 
Sample Link: https://www.syncfusion.com/downloads/support/forum/157918/ze/ModifiedSample1764697229

Please let us know, if you require further assistance on this.

Regards,
Vijayarasan S 



TG The GridLock November 3, 2020 04:31 PM UTC

Hi Vijayarasan ,
As in this answer, while convert the datatable -> dynamic datatable I checked the dbnull and reassigned the match type (string.empty or null). (I mean I used the code you just provided to remove dbnull before)
however, that column is not initialized. If I change value in the 2nd cell so it is not blank, the column will be created. The problem I am mentioning is whether the column is initialized or not / depends on whether the second cell is empty or not empty. or row[columnname] =null [first value follow header DataTable value]



VS Vijayarasan Sivanandham Syncfusion Team November 4, 2020 11:48 AM UTC

Hi Khanh Dang,

Thanks for the update.

We have generate the column based on column first cell value of DataRow based DynamicDataTable set as DataSource for SfDataGrid. We do not generate the column based on Header row cell in SfDataGrid.

Based on provided information we have checked the reported issue “DynamicDataTable set as DataSource for SfDataGrid when the column not generating for DBNull Property type”. We have tested with sample level fix and unable to replicate the issue from our end. it is working fine as expected. Please find the tested sample and video demo from our end in the below link,
   
Video Link: https://www.syncfusion.com/downloads/support/forum/157918/ze/DataTableColumn-1528066792

Please let us know, if you require further assistance on this.

Regards,
Vijayarasan S 


Loader.
Up arrow icon