Quantcast
Viewing all articles
Browse latest Browse all 12583

DatagridView.DataPropertyName is always Alias!

Hello!

I have a query:

SELECT CODE AS [CODE CUSTOMER], NAME, SURNAME FROM MyTable

I Have a datatable from this query.

I Set DataGridView.Datasource = myDatatable.
DataGridView.AutoGenerateColumns = true
DataGridView.Databind

After databind, all DataGridViewColumns.DataPropertyName is SQL Alias and not the "effective db_field"

For Example: the first DataGridViewColumns.DataPropertyName = "CODE CUSTOMER" and not "Code".

Is there any way to have also "effective db_field"?

If not possible, How can I add my custom Column property "DBField"? I would bind manually....

Thanks!



Viewing all articles
Browse latest Browse all 12583

Trending Articles