<br /> public void InsertFNF(FileInfo file)<br /> {<br /> string strConString = ConfigurationSettings.AppSettings["dbConnectionString"];<br /> <br /> string textLine = "";<br /> System.IO.StreamReader obsReader;<br /> int CountLine = File.ReadAllLines(file.FullName).Length;<br /> //I am getting 4486 lines in my file<br /> <br /> obsReader = new System.IO.StreamReader(file.FullName);<br /> do<br /> {<br /> textLine = obsReader.ReadLine();<br /> string[] allFile = textLine.Split('|');<br /> string strSql = "";<br /> string query;<br /> <br /> OleDbConnection conn = new OleDbConnection(strConString);<br /> conn.Open(); // 1. Instantiate a new command with command text only<br /> <br /> // foreach (DataRow prow in oDSfull.Tables["CM_SYSTEM_MENU"].Rows)<br /> // {<br /> try<br /> {<br /> query = @"INSERT INTO SERVICE_CDR_FO_PARTY(CDR_TYPE,A_PARTY,TIME_STAMP,SERVICE_EVENT,CDR_FILE) "<br /> + "VALUES ('" + allFile[0].ToString() + "', '" + allFile[3].ToString() + "',TO_DATE(" + allFile[2].ToString() + ",'yyyyMMDDHH24MISS'),'" + allFile[1].ToString() + "','" + file.Name.ToString() + "')";<br /> <br /> OleDbCommand olcmd = new OleDbCommand(query); // 2. Set the Connection property<br /> olcmd.Connection = conn;<br /> olcmd.ExecuteNonQuery();// 3. Call ExecuteNonQuery to send command<br /> <br /> }<br /> catch (Exception)<br /> {<br /> <br /> conn.Close();<br /> }<br /> }<br /> //while (CountLine!=1);<br /> while (obsReader.Peek() != -1);<br /> obsReader.Close();<br /> <br /> <br /> <br /> }<br /> <br />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)