|
-
May 8th, 2007, 07:15 PM
#1
Thread Starter
Hyperactive Member
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
-
May 9th, 2007, 04:04 AM
#2
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|