title: Prevent login of ODBC Text driver in Crystal Report for Visual Studio 2010
body: <p>I am new to Crystal Report and I have a problem I cannot figure out.
  Because I cannot find an answer anywhere I try it this way.</p>
  
  <p>I am using a Crystal Report which uses an ODBC database with a text driver as a datasource.
  This report works perfect when opening it with the standalone Crystal Report XI.</p>
  
  <p>When opening it via VS2010 over a basic c#-program I am always prompted for the Username and Password for this DB, in spite there is none of this.
  Because of this I cannot access the data.</p>
  
  <p>The strange thing is, that it is possible to access the data of the fields via "Browse Field Data" in the editor.</p>
  
  <p>Is there something I am missing?
  </p>
  
  <pre class="lang-cs prettyprint-override"><code>namespace CrystalReportsApplication1
  {
      public partial class Form1 : Form
      {
          private string reportPath;
          private ReportDocument repDoc = new ReportDocument();
          private FileInfo m_AssemblyCS;
          private DirectoryInfo m_SolutionRoot;
  
          public Form1()
          {
              InitializeComponent();
              m_AssemblyCS = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
              m_SolutionRoot = m_AssemblyCS.Directory.Parent.Parent.Parent;
              reportPath = string.Empty;
          }
  
          private void bOpenReport_Click(object sender, EventArgs e)
          {
              OpenFileDialog openFileDialog1 = new OpenFileDialog();
              openFileDialog1.InitialDirectory = m_SolutionRoot.FullName;
              openFileDialog1.Filter = "rpt files (*.rpt)|*.rpt|All files (*.*)|*.*";
  
              if (openFileDialog1.ShowDialog() == DialogResult.OK)
              { 
                  reportPath = openFileDialog1.FileName;
                  tbReportPath.Text = reportPath;
                  repDoc.Load(reportPath);
                  crystalReportViewer.ReportSource = repDoc;
              }
          }
      }
  }
  </code></pre>
  
  <h2>Update</h2>
  
  <p>Unfortunately the se hasn't helped. I still get the error. I tried to following:</p>
  
  <pre class="lang-cs prettyprint-override"><code>private void bOpenReport_Click(object sender, EventArgs e)
  {
    OpenFileDialog openFileDialog1 = new OpenFileDialog();
    openFileDialog1.InitialDirectory = m_SolutionRoot.FullName;
    openFileDialog1.Filter = "rpt files (*.rpt)|*.rpt|All files (*.*)|*.*";
  
    if (openFileDialog1.ShowDialog() == DialogResult.OK)
    { 
      reportPath = openFileDialog1.FileName;
      tbReportPath.Text = reportPath;
      repDoc.Load(reportPath);
  
      foreach(Table table in repDoc.Database.Tables)
        SetConnectionInfo(table.Name, "dds", "", "", "");
  
      crystalReportViewer.ReportSource = repDoc;
    }
  }
  
  private void SetConnectionInfo(string table, string server, string database, string user, string password)
  { 
    TableLogOnInfo logOnInfo = new TableLogOnInfo();
    logOnInfo = repDoc.Database.Tables[table].LogOnInfo;
    ConnectionInfo connectionInfo = new ConnectionInfo();
    connectionInfo = logOnInfo.ConnectionInfo;
  
    connectionInfo.DatabaseName = database;
    connectionInfo.ServerName = server;
    connectionInfo.Password = password;
    connectionInfo.UserID = user;
    repDoc.Database.Tables[table].ApplyLogOnInfo(logOnInfo);
  }
  </code></pre>
  
  <p>The connectionInfos of the tables are set, but I still get the login-dialog.</p>