AnsweredAssumed Answered

Transfer of data from PI to Sql using PI SDK

Question asked by NEERAJ on Dec 18, 2015
Latest reply on Feb 2, 2016 by Marcos Vainer Loeff

Hi,

 

I have tried transferring data from PI to Sql using OLEDB but now i am wondering if transfer of data can be done more faster using PI SDK ,I am not able to find out any help material for querying through PI SDK .

 

Below is my approach for transferring data through oledb,can we do data transfer using PI SDK, any example would a great help

public void getresult()

{

string connStr = ConfigurationManager.ConnectionStrings["OLEDB"].ConnectionString;
using (OleDbConnection connection = new OleDbConnection(connStr))
{
DataTable result = new DataTable();

OleDbCommand Cmd = new OleDbCommand();
Cmd.Connection = connection;// (MainQuery, connection);
Cmd.CommandTimeout = 1980; string MainQuery;
OleDbDataReader dr1;
{

if (connection.State.ToString() != "Open")
connection.Open();

{

  1. result.Clear(); result.Columns.Clear(); result.Rows.Clear();
    try
    {

MainQuery = "select * from piavg where tag='G0001.A.V1' and time > '01-aug-2014' and time < '02-aug-2015' and timestep='1h'";     

      Cmd.CommandText = MainQuery;

dr1 = Cmd.ExecuteReader();         

  result.Load(dr1);
// result is inserted into sql
}

catch (Exception ex)
{
}

}

}

}
}

Outcomes