您好,
不用数据库使用的占用参数的方式不一致。
可以参考以下文档
Case 1 - OleDB
<Steps>
1. Open UD
2. Create new Page/RDL report
3. Add new DataSource
4. As connection type use Microsoft OleDb Provider and as OLE DB Provider use Microsoft.Jet.OLEDB.4.0
5. Fill up connection info to database (e.g. NWIND.MDB) and save DataSource
6. Add new DataSet
7. In query tab insert SQL expression with parameter (e.g. "SELECT * FROM Customers WHERE (Country = ? AND City = ?)")
8. Click "Tab" to validate the query
9. Go to "arameters" tab of DataSet dialog
Expected: Parameter1 and Parameter2 is added
10. Set to parameters values "=[@Parameter1]" and "=[@Parameter2]" accordingly
11. Save DataSet
12. Place one or few Fields from DataSet1 to Page (e.g. "CustomerID", "CompanyName", "Address" and "ostalCode")
13. Click "review report" and fill up parameters with valid values (e.g. Parameter1 = "Germany" and Parameter2 = "Berlin")
14. Click "View report" button
Expected: Report is previewed successfully and fields are populated with valid values accordingly to parameters values (e.g. "ALFKI", "Alfreds", "Obere Str. 57" and "12209" accordingly).
Case 2 - ODBC
<Steps>
1. Steps 1-3 from case 1
2. As connection type use Microsoft Odbc Provider
3. Fill up connection string (e.g. "Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\NWIND.mdb") and save DataSource
4. Add new DataSet
5. In query tab insert SQL expression with parameter (e.g. "SELECT * FROM Customers WHERE (Country = @Parameter1 AND City = @Parameter2)")
6. Steps 8-14 from case 1
Expected: Report is previewed successfully and fields are populated with valid values accordingly to parameters values (e.g. "ALFKI", "Alfreds", "Obere Str. 57" and "12209" accordingly).
Case 3 - SQL Client
<Steps>
1. Steps 1-3 from case 1
2. As connection type use Microsoft Sql Client Provider
3. Fill up connection string (e.g. "user id=sa;data source=192.168.33.45;initial catalog=NWIND;password=123;"), at "Connection Properties" tab set "Save my password" checkbox and save DataSource
4. Add new DataSet
5. In query tab insert SQL expression with parameter (e.g. "SELECT * FROM Customers WHERE (Country = @Parameter1 AND City = @Parameter2)")
6. Steps 8-14 from case 1
Expected: Report is previewed successfully and fields are populated with valid values accordingly to parameters values (e.g. "ALFKI", "Alfreds", "Obere Str. 57" and "12209" accordingly).
Case 4 - OracleDB
<Steps>
1. Steps 1-3 from case 1
2. As connection type use Oracle Client Provider
3. Fill up connection string (e.g. "User Id=adminassword=1;Data Source=oraserver:1521/xe;"), at "Connection Properties" tab set "Save my password" checkbox and save DataSource
4. Add new DataSet
5. In query tab insert SQL expression with parameter (e.g. "SELECT * FROM Customers WHERE (Country = : Parameter1 AND City = : Parameter2)")
6. Steps 8-14 from case 1
Expected: Report is previewed successfully and fields are populated with valid values accordingly to parameters values (e.g. "ALFKI", "Alfreds", "Obere Str. 57" and "12209" accordingly). |