Results 1 to 2 of 2

Thread: crystal report in ms access with password

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Location
    /root/usr/local/bin
    Posts
    476

    crystal report in ms access with password

    i use this code but in crystal report it shows the logon diaglog box
    how do i connect in access?

    public static string conString = @"Provider=Microsoft.JET.OLEDB.4.0;" + @"data source= " + Application.StartupPath + "/CQSTest.MDB" +";Persist Security Info=False;jet oledb:database password=1234567";


    this.Cursor = Cursors.WaitCursor;
    OleDbConnection conn = new OleDbConnection(cVar.conString);
    conn.Open();
    OleDbCommand comm = conn.CreateCommand();

    comm.CommandText = "SELECT * FROM tblData WHERE COMPOUND_NO = '" + cboCompoundNo.Text + "' AND MIXING_DATE BETWEEN #" + dtpFrom.Text + "# AND #" + dtpTo.Text + "# ORDER BY MIXING_DATE DESC";
    cVar.dataReader = comm.ExecuteReader();
    try
    {
    if (cVar.dataReader.HasRows)
    {
    cVar.dataReader.Close();
    OleDbDataAdapter da = new OleDbDataAdapter(comm);
    DataTable dt = new DataTable();
    da.Fill(dt);

    //INSERT_DUMMY_DATE_COVERED();

    crData cData = new crData();//landscape
    cData.SetDataSource(dt);
    frmPrintPreview fData = new frmPrintPreview();
    fData.crystalReportViewer1.ReportSource = cData;
    fData.ShowDialog();
    }
    else
    {
    MessageBox.Show("Record not found, please try again.", "No record", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    }
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    cVar.dataReader.Close();
    conn.Close();
    this.Cursor = Cursors.Default;
    }

    need help

  2. #2
    Addicted Member
    Join Date
    Jun 2005
    Posts
    169

    Re: crystal report in ms access with password

    The first point in this article should help:
    http://aspalliance.com/490

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width