how to pass parameters in other oledb providers apart from SQL server native client
-
2012年2月24日 上午 09:31
what will be the query in other oledb provider if I need to pass parameters?
Suppose in SQL server Oledb source I am using
select * from Test where ID=?
What will be the query if I need pass the parameter using other oledb provider (PI Oledb provider).
Please help
thanks
Saikat
所有回覆
-
2012年2月24日 上午 09:43
Hi, the easiest way is to use a variable. Check the link below:
http://stackoverflow.com/questions/58540/how-to-resolve-sql-query-parameters-mapping-issues-while-using-oracle-ole-db-pro
David.
-
2012年2月24日 上午 10:05
David,
Its not working. Below is the query in which I need to pass parameter. This is the PI server query.
SELECT i1.tag, i1.time, i1.value
FROM piarchive..piinterp i1
WHERE i1.tag=? AND i1.time BETWEEN 'T-30d' AND 't'
AND i1.timestep = '15m'Now, if I follow the above link and put the following query in the expression
"SELECT i1.tag, i1.time, i1.value
FROM piarchive..piinterp i1
WHERE i1.time BETWEEN 'T-30d' AND 't'
AND i1.timestep = '15m' AND i1.tag= " + @[User::PiTagName]I got the below result on clicking Evaluate expression button which is not correct.
SELECT i1.tag, i1.time, i1.value
FROM piarchive..piinterp i1
WHERE i1.time BETWEEN 'T-30d' AND 't'
AND i1.timestep = '15m' AND i1.tag= SELECT i1.tag, i1.time, i1.value
FROM piarchive..piinterp i1
WHERE i1.time BETWEEN 'T-30d' AND 't'
AND i1.timestep = '15m' AND i1.tag=
-
2012年2月24日 上午 10:08
You need to create two variables, one for the query and another for the parameter, and in the query variable (that is evaluated as an expression) you should put your select + variable (the one with the filter value).
David.
- 已標示為解答 Saikat_1983 2012年2月24日 上午 11:07
-
2012年2月24日 上午 11:07
Thanks David for the solution.

