OleDb - As to use named parameters
-
- Posts: 3
- Joined: Sun Apr 15, 2007 7:16 pm
OleDb - As to use named parameters
Hello!
I am evaluating the StimulReport.Net to use it in a Web application.
My reports possess parameters and I possess used pages to get these parameters of the user.
As my application must be able to use Oracle or SQL Server, I am using OleDb as connection with the Database.
I use StimulReport 2007 in Portuguese with Windows XP SP2
I need to use parameters in some consultations, where the same parameter is used more than a time in one same instruction SQL:
SELECT *
FROM SSEmpresa
WHERE (@pCodEmpresa = 0 OR EM_Codigo = @pCodEmpresa)
@pCodEmpresa is used some times in the SQL.
This is only one example. I have several other similar situations.
I am receiving the following message when trying to emit the report (Portuguese Br):
Não foi possível preparar instrução(ões)
É necessário declarar a variável escalar "@pCodEmpresa".
I tried to use the parameters with the character "?", but in this in case that it is necessary to inform value for parameter the same two times.
How I make to use parameters named with OleDb connection?
Thank you,
Weber Miranda.
I am evaluating the StimulReport.Net to use it in a Web application.
My reports possess parameters and I possess used pages to get these parameters of the user.
As my application must be able to use Oracle or SQL Server, I am using OleDb as connection with the Database.
I use StimulReport 2007 in Portuguese with Windows XP SP2
I need to use parameters in some consultations, where the same parameter is used more than a time in one same instruction SQL:
SELECT *
FROM SSEmpresa
WHERE (@pCodEmpresa = 0 OR EM_Codigo = @pCodEmpresa)
@pCodEmpresa is used some times in the SQL.
This is only one example. I have several other similar situations.
I am receiving the following message when trying to emit the report (Portuguese Br):
Não foi possível preparar instrução(ões)
É necessário declarar a variável escalar "@pCodEmpresa".
I tried to use the parameters with the character "?", but in this in case that it is necessary to inform value for parameter the same two times.
How I make to use parameters named with OleDb connection?
Thank you,
Weber Miranda.
OleDb - As to use named parameters
Please note that unnamed parameters works usually with any Server and it is not depends on the version of the OleDb driver. But sometimes using of named parameters with OleDB connection is not possible. In that case you need to use special Database pack for your Server.webermiranda wrote:Hello!
I am evaluating the StimulReport.Net to use it in a Web application.
My reports possess parameters and I possess used pages to get these parameters of the user.
As my application must be able to use Oracle or SQL Server, I am using OleDb as connection with the Database.
Oracle provider for the StimulReport.Net you can to download here:
http://stimulsoft.com/Downloads/OracleDatabase.zip
Also possible using a variable from the Dictionary as parameter:
Code: Select all
select Category from Categories where CategoryID = {myParameter}
Thank you.
OleDb - As to use named parameters
Please note that unnamed parameters works usually with any Server and it is not depends on the version of the OleDb driver. But sometimes using of named parameters with OleDB connection is not possible.
Unnamed parameters allows to achieve the goal. But we cannot influence on processing of the named parameters, because ADO.Net processing this.
Thank you.
Unnamed parameters allows to achieve the goal. But we cannot influence on processing of the named parameters, because ADO.Net processing this.
Thank you.
-
- Posts: 3
- Joined: Sun Apr 15, 2007 7:16 pm
OleDb - As to use named parameters
Thank, Edward.
Using variables of the dictionary as parameters it will be possible to make what necessary.
Using variables of the dictionary as parameters it will be possible to make what necessary.
OleDb - As to use named parameters
Yes, you can use expression in sql query. For example:
but in this case you need be very careful with dates.
Thank you.
Code: Select all
select * from customers where id={variable}
Thank you.
-
- Posts: 3
- Joined: Sun Apr 15, 2007 7:16 pm
OleDb - As to use named parameters
The dates will not be a problem in this in case that, therefore they are recorded in fields of the Integer type, in format YYYYMMDD.
Thank you!
Thank you!
OleDb - As to use named parameters
Thank you.