Dynamic Queries | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Dynamic Queries

Hello I’m trying to run the following against the Northwind database. I am getting an error when I go to preview this. Can anyone assist, I’m totally new to Reporting Services AND .NET.
The Query It basically displays the orders between certain dates. The two input parameters are FromDate1 and FromDate2. If I hard code two dates into a query it works fine. Tushar
="SELECT CompanyName, ShipAddress, ShipCity, ProductName, Products.UnitPrice, Quantity, OrderDate, RequiredDate, ShippedDate FROM orders,[Order Details], Customers, Products WHERE orders.orderid=[Order Details].orderId AND customers.customerID=orders.customerid and products.productId=[Order Details].productId and OrderDate BETWEEN ‘" & Parameters!FromDate1.Value.ToString & "’ AND ‘" & Parameters!FromDate2.Value.ToString & "’"
An error has occured during report processing.
Cannot set the text for data set ‘DataSet1’.
Error during the processing of the CommandText expression of dataset ‘DataSet1’