I am importing values like 0000,0002,0023,0034 from a text file. However, the table shows them as 0, 2, 23, 34. Does anyone know why it is removing the leading zeros?
Here is my code:
private DataTable ImportTabFile()
{
string dataSourcePath = @"C:\Documents and Settings\agordon\Desktop";
string dataFileName = "ACTIVITYEX.txt";
string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dataSourcePath + @";Extended Properties=""text;HDR=No;FMT=Delimited""";
OleDbConnection conn = new OleDbConnection(connString);
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = String.Format("SELECT * FROM [{0}]", dataFileName);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds);
return ds.Tables[0];
}
How can I keep the leading zeroes during the import?
here is what my schema file looks like:
[ACTIVITYEX.txt]
Format=TabDelimited
ColNameHeader=False
Col13=ErrorCode Text