title: I am trying to return OrderDates from a specific CustomerName and ProductName with the following code:
body: <pre><code>PreparedStatement prep = null;
  
  try {
      prep = conn.prepareStatement(&quot;SET SCHEMA CECS323LAB&quot;);
      prep.executeQuery();
  
      String query = &quot;select OrderDate&quot; +
              &quot;from ORDERS O inner join ORDERDETAILS OD on O.ORDERNUMBER = OD.ORDERNUMBER &quot; +
              &quot;inner join PRODUCTS P on P.PRODUCTCODE = OD.PRODUCTCODE &quot; +
              &quot;where PRODUCTNAME = ?&quot; +
              &quot;and &quot; +
              &quot;CUSTOMERNUMBER = ( select CUSTOMERNUMBER from CUSTOMERS where CUSTOMERNAME like '%Euro%' )&quot;;
  
      assert conn != null;
      prep = conn.prepareStatement(query);
  
      prep.setString(1, &quot;1957 Chevy Pickup&quot;); // replace the first ? with the sanitized customer's name.
      //prep.setString(2,customerName);
  
      
      ResultSet data = prep.executeQuery();}
  </code></pre>
  <p>but I get the following error:</p>
  <blockquote>
  <p>Caused by: java.sql.SQLException: Statement.executeQuery() cannot be
  called with a statement that returns a row count.</p>
  </blockquote>