1
Reply

scientific notation in dataset c#

otto sembach

otto sembach

Jun 2 2009 4:27 PM
6.6k

Hi.
I use VS 2003.
I load a speadsheet in a windows c# appl. and display the data in a dataview.
The columns are define as string in the dataset.
 
I got a problem when I display the data i the dataview, sometimes the data are showing in  scientific notation e.g 3.87299e+009, how can I avoid it or format the dataset. ?.
Data in the dataview look like this:
Column1      Culoumn2         Cuolmn3
32AD         32AD992001      35TJ995865
32AD         32AD992002      35TJ995865
32CD         32CD992132      32TJ995878
32AD         32AD992001      35TJ995865
32AD         32AD992002      35TJ995865
32CD         32CD992132      32TJ995878
32AD         32AD992001      35TJ995865
32AD         32AD992002      35TJ995865
3272         3.87299e+009    3200995878
3272         3.87299e+009   3201995450

 
 
 
 
 
 
FileInfo fi = new FileInfo(openFileDialog1.FileName); 
opendir = fi.DirectoryName;        
string strCsvFilePath = opendir + "\\" + fi.Name;
string strFilePath = opendir;
string MyConnectStr = "provider=Microsoft.Jet.OLEDB.4.0; data source=" +openFileDialog1.FileName  + "; Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;ImportMixedTypes=Text;'";
OleDbConnection MyConnection;                                                                                                                                        MyConnection = new OleDbConnection(MyConnectStr);
oleDbDataAdapter1.SelectCommand=new OleDbCommand("select * from  [Sheet1$] ", MyConnection);
oleDbDataAdapter1.Fill(dataSet1,"excel");
dataGrid1.SetDataBinding(dataSet1,"excel");
MyConnection.Close();



Answers (1)