title: Set Datasource location on Crystal Reports 2008 report
body: <p>I have a Crystal Reports 2008 report with dynamic parameters (e.g Distribution point which are referring to a column <code>DP.distributionPoint</code>). When opening the report in my application (C#) I am setting the datasource at run time and report opens properly and on the <code>Enter Parameter Values</code> window for report shows available values for distribution point (<code>DP.distributionPoint</code>). </p>
  
  <p>Code I am using to set datasource dynamically (note there is no subreport for this report, but report is referring to database tables and views from the database) </p>
  
  <pre><code>SetDataSource(ReportDocument report, string serverName, string databaseName)
  {
      //  Set the connection for the main report.
      report.DataSourceConnections[0].SetConnection(serverName, databaseName, true);
  
      TableLogOnInfo tableLogonInfo = new TableLogOnInfo();
      ConnectionInfo connectionInfo = new ConnectionInfo();
      connectionInfo.DatabaseName = databaseName;
      connectionInfo.ServerName = serverName;
      connectionInfo.IntegratedSecurity = true;
  
      foreach (Table table in report.Database.Tables)
      {
          tableLogonInfo = table.LogOnInfo;
          tableLogonInfo.ConnectionInfo = connectionInfo;
          table.ApplyLogOnInfo(tableLogonInfo);
  
          table.Location = tableLogonInfo.ConnectionInfo.DatabaseName + ".dbo." +
                       table.Location.Substring(table.Location.LastIndexOf(".") + 1);
      }
  }
  </code></pre>
  
  <p>I need to set datasource every time I open the report. My plan is to set datasource on the report and save the report with location information, so next time I need not to call set datasource. </p>
  
  <p>But when I test the application without setdatasource, I can open the report but 
  Available Values for Distribution point in ‘Enter Parameter Values’ window is not showing now.</p>
  
  <p>Note:</p>
  
  <ol>
  <li><p>I have checked the table.LogOnInfo.ConnectionInfo.ServerName and table.LogOnInfo.ConnectionInfo.DatabaseName for all the tables/views in the report it is same as the database I am connecting to.</p></li>
  <li><p>If I set set table.Location I can view Available Values List.</p></li>
  </ol>
  
  <p>Questions:</p>
  
  <ol>
  <li>Why available values list not showing when I open the report without setdatasource function?</li>
  <li>Is it possible to change/control the available values for FieldParameter programmatically in Crystal Reports 2008?</li>
  </ol>