OleDB with C# to query data from an WinCC oa archive

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
3 posts • Page 1 of 1
mwerksma
Posts:19
Joined: Fri Jul 01, 2011 1:21 pm

OleDB with C# to query data from an WinCC oa archive

Post by mwerksma »

Hello,

With the code below I try to read data from an WinCC archive.
I use a default new WinCC oa project to test this code with on one pc with an OLEDB manager.

string strProvider = "Provider=PVSSoledb.PVSSoledb;Data Source=localhost:4444";
string strSql = "SELECT DPNAME,OFFLINEVALUE,STIME FROM HISTVAL WHERE DPNAME LIKE \\"ExampleDP_Arg*\\" ";
OleDbConnection con = new OleDbConnection(strProvider);
OleDbCommand cmd = new OleDbCommand(strSql, con);
con.Open();
cmd.CommandType = CommandType.Text;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataTable data = new DataTable();
da.Fill(data);
dataGridView1.DataSource = data;

I do get data but I only get one record whatever the query is.

Does anyone have an idea what this could be?

Regards Marcel

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: OleDB with C# to query data from an WinCC oa archive

Post by leoknipp »

Hello,

I made a test using WinCC OA 3.11+SP1 (32bit-version) and Excel 2010.
When reading the HISTVAL-table is see all values for the datapoint-elements stored in the historical database.

Which WinCC OA version are you using?
Which type of database are you using?
Do you get the correct values when using another OLE DB consumer (e.g. Excel)?

Best Regards
Leopold Knipp
Senior Support Specialist

mwerksma
Posts:19
Joined: Fri Jul 01, 2011 1:21 pm

Re: OleDB with C# to query data from an WinCC oa archive

Post by mwerksma »

Hello,

I use Windows XP SP3 and Windows 32 bits, Office 2003 and WinCC oa 3.10 SP2 with patches:
WinCC_OA3102P006
WinCC_OA3102P013
WinCC_OA3102P017

The database is a default new WinCC oa database with only a OleDB manager added, that's all.

When I use the default Excel example with query HISTVAL, I get alle fields but still only 1 record.


Anyone an idea what I am doing wrong??




:S

3 posts • Page 1 of 1