1

I have a CSV file, I use SCHEMA.INI file to structure the import of the .csv file.

I have some problem in Phone number field, Customer upload the phone number with (06)1234565, so i choose Text field in SCHEMA.ini file.

When i convert my csv to datatable the Phone number field will convert like 4.32E+12, Original Phone number is 4320000000000.

Also in Schema.ini i tried Memo, Char Width 20, etc,. Exponent form not converted.

enter image description here

How can i convert to original format ?

string FileName = Path.GetFileName(FilePath);
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + folderpath + ";" + "Extended Properties=\"text;HDR=YES\"";

OleDbConnection Conn = new OleDbConnection();
Conn.ConnectionString = strConn;
Conn.Open();

string s1 = "select * from [" + FileName + "]";
OleDbDataAdapter da1 = new OleDbDataAdapter(s1, Conn);

DataSet dtall = new DataSet();
da1.Fill(dtall);
Conn.Close();

In Datatable the phone number should be value not in Exponent form.

Any help Much appreciated, Many Thanks.

rAm
  • 199
  • 2
  • 19
  • You have some unknown or undefined definitions in there. There is no `float` use `single`, also `hh:nn:ss` is nonsense. Even with `Text` I think you are supposed to specify `Width ##` even though it doesnt seem it should be needed. I dont know what OLE does when it runs into such things (ignore the schema or just that column?). You might also play with an [IMEX setting](https://stackoverflow.com/a/28569981/1070452) in your conn string. – Ňɏssa Pøngjǣrdenlarp Jul 30 '19 at 14:56
  • @ŇɏssaPøngjǣrdenlarp Thanks for your comment, Please check the https://learn.microsoft.com/en-us/sql/odbc/microsoft/schema-ini-file-text-file-driver?view=sql-server-2017 link for schema.ini file type, I tried IMAX=0 1 and 2. But the exponent value not changed. – rAm Jul 31 '19 at 05:33

0 Answers0