![]() StrB.Append("Col" ColIndex. Got Ans: Step 1: Question Right click to solution -> properties -> Targeted Plateform to (x86). StringBuilder strB = new StringBuilder() įor (Int32 ColIndex = 1 ColIndex <= dt.Columns.Count ColIndex ) ![]() S2 = "ColNameHeader=" bolColName.ToString() StreamWriter srOutput = new StreamWriter(fsOutput) Log.Info("In Writing Schema File Function") įileStream fsOutput = new FileStream(strCSVFilePath "\\schema.ini", FileMode.Create, FileAccess.Write) Obj_oledb_da.FillSchema(dtSchema, SchemaType.Source) OleDbDataAdapter obj_oledb_da = new OleDbDataAdapter(cmd) OleDbCommand cmd = new OleDbCommand(sql_select, conn) String strConnString = "Provider=.4.0 Data Source=" strCSVFilePath " Extended Properties='text HDR=Yes FMT=Delimited(,)' " Ĭonn = new OleDbConnection(strConnString.Trim()) The problem is solved wiht this code private DataTable ImportCSVData() private DataTable ImportCSVData() Kindly suggest how can load all fields as Text. Hi, I am reading CSV file using OleDB Provider my code is working fine but I have requirement that any filed or columns which is numeric or date time type will be loaded as text.i am using schema.ini file to override some some properties bellow is my code.
0 Comments
Leave a Reply. |