AnsweredAssumed Answered

Delete data from Archive

Question asked by jainc_paresh on Aug 12, 2015
Latest reply on Aug 12, 2015 by dng

Hello Team,


I am having datalink report which is calculating number of hours unit in service for a day and cumulative value between unit initial start till today. But, due to some know and unknown reason I/O Timeout and Configure values are archived in PI Database. This is returning wrong value for daily and cumulative report, this report is critical report for customer so that want exact running hours.


Hence, I have written a stand alone code in ASP.NET which will deleted these values provided startdate and enddate. Below is the code snippet.


string strConPI = "Data Source=Collectivename;Integrated Security=true;Initial Catalog=piarchive;Provider=PIOLEDB.1;Always Return Rowset=True";


if (dt != null && dt.Rows.Count > 0)


                    foreach (DataRow dr in dt.Rows)


                        strCmd = "Delete From [piarchive].[picomp2] "

                                + "Where ( status = -246 or status = -240 ) and tag = '" + dr["TagName"] + "' and time between '" + startdate Value + "' and '" + enddate.Value + "'";

                        using (OleDbConnection oledbCon = new OleDbConnection(strConPI))



                            OleDbCommand oledbCmd = new OleDbCommand(strCmd, oledbCon);

                            int i = oledbCmd.ExecuteNonQuery();





But, when I execute this code I am getting below error message. "Row deleting failed. [PI SDK] Write failed.  Unbuffered write would desynchronize archive data. CollectiveName"


Please suggest.


Thanks & Regards

Paresh Jain