EDN Admin
Well-known member
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
I am working on a DataGridView in Windows Form in VS 2010
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
I have bound DataGridView with a DataTable having a DATE field.
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Now the problem is, the date in the Data Table is in US format <em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent (09-25-2012)[/i], whereas, that date to be bound to my Grid is in BRITISH format <em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent (25-09-2012)[/i]
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
The format in the DataGridView is changed with the following statement.
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
<em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent dgvWeekNames.Columns[1].DefaultCellStyle.Format = "dd-MM-yyyy";[/i]
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Now, when I update it with the OledbDataAdapter.Update(myDataTable);
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
When I call the above statement while editing the cell in the datagridview, the error shown is <strong style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent "string was not recognized as a valid datetime"
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
I am sure that the date format in the GRID is as <em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent (25-09-2012)[/i] whereas the dateformat in the database table is in <em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent (09-25-2012)[/i].
So the data to be updated is different from the format in the database table.
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Anyone can give me a solution for it?
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Thanking you, Tomy
View the full article
I am working on a DataGridView in Windows Form in VS 2010
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
I have bound DataGridView with a DataTable having a DATE field.
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Now the problem is, the date in the Data Table is in US format <em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent (09-25-2012)[/i], whereas, that date to be bound to my Grid is in BRITISH format <em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent (25-09-2012)[/i]
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
The format in the DataGridView is changed with the following statement.
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
<em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent dgvWeekNames.Columns[1].DefaultCellStyle.Format = "dd-MM-yyyy";[/i]
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Now, when I update it with the OledbDataAdapter.Update(myDataTable);
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
When I call the above statement while editing the cell in the datagridview, the error shown is <strong style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent "string was not recognized as a valid datetime"
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
I am sure that the date format in the GRID is as <em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent (25-09-2012)[/i] whereas the dateformat in the database table is in <em style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent (09-25-2012)[/i].
So the data to be updated is different from the format in the database table.
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Anyone can give me a solution for it?
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Thanking you, Tomy
View the full article