Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

data format changing from database to datagridview

$
0
0

hi I am trying to display data from database sqlite  to datagridview the data format changed automatically

the date in database is

2012-02-2016:42:10.00 but on datagrid view it appears like  20/02/201216:42:10,

{
                        swOut.Write(",");}
                    swOut.Write(dataGridView1.Columns[i].HeaderText);}

                swOut.WriteLine();//write DataGridView rows to csvfor(int j =0; j <= dataGridView1.Rows.Count-1; j++){if(j >0){
                        swOut.WriteLine();}

                    dr = dataGridView1.Rows[j];for(int i =0; i <= dataGridView1.Columns.Count-1; i++){if(i >0){
                            swOut.Write(",");}

                        value = dr.Cells[i].Value.ToString();//replace comma's with spaces
                        value = value.Replace(',',' ');//replace embedded newlines with spaces
                        value = value.Replace(Environment.NewLine," ");

                        swOut.Write(value);

Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>