Skip to Content
0
Former Member
Feb 28, 2007 at 05:13 PM

change logon info at running time(using ms access)

87 Views

hi there,<br />I&#39;d like to ask the solution for my problem.<br />I made a new project using ms access 2003,crystal report 9, and visual studio 2005.<br /><br />I just made a simple access dbase with 1 table(Table 1) and protected with password, o I forgot this table has 2 field(id and desc).<br />After that I made simple report that using DAO connectivity(save data with report option is disabled).<br /><br />At last I made simple program(windows app) using visual studio 2005.<br />I put the CrystalReportViewer component, and these is the code :<br /><br />

<br />using System;<br />using System.Collections.Generic;<br />using System.ComponentModel;<br />using System.Data;<br />using System.Drawing;<br />using System.Text;<br />using System.Windows.Forms;<br /><br />namespace prj<br />{<br />   public partial class Form1 : Form<br />   {<br />       public Form1()<br />       {<br />           InitializeComponent();<br />       }<br /><br />       private void crystalReportViewer1_Load(object sender, EventArgs e)<br />       {<br /><br />       }<br /><br />       private void Form1_Load(object sender, EventArgs e)<br />       {<br />           crystalReportViewer1.ReportSource = System.Environment.CurrentDirectory + "\Report1.rpt";<br />           crystalReportViewer1.LogOnInfo[0].ConnectionInfo.UserID = "Admin";<br />           crystalReportViewer1.LogOnInfo[0].ConnectionInfo.Password = "12";<br />           crystalReportViewer1.LogOnInfo[0].ConnectionInfo.DatabaseName = System.Environment.CurrentDirectory + "\db.mdb";<br />           crystalReportViewer1.LogOnInfo[0].ConnectionInfo.ServerName = System.Environment.CurrentDirectory + "\db.mdb";<br />       }<br />   }<br />}<br />

<br /><br />and the problem is when I move the access database file to other location, the viewer shows a box to be confirmed by my UserID and password,<br />my question is how must I write in the program so that the box doesnt come out.<br /><br />thanks