change logon info at running time(using ms access)

HSoft

New member
Local time
Today, 15:37
Joined
Feb 28, 2007
Messages
4
hi there,
I'd like to ask the solution for my problem.
I made a new project using ms access 2003,crystal report 9, and visual studio 2005.

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).
After that I made simple report that using DAO connectivity(save data with report option is disabled).

At last I made simple program(windows app) using visual studio 2005.
I put the CrystalReportViewer component, and these is the code :

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace prj
{
   public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();
       }

       private void crystalReportViewer1_Load(object sender, EventArgs e)
       {

       }

       private void Form1_Load(object sender, EventArgs e)
       {
           crystalReportViewer1.ReportSource = System.Environment.CurrentDirectory + "\\Report1.rpt";
           crystalReportViewer1.LogOnInfo[0].ConnectionInfo.UserID = "Admin";
           crystalReportViewer1.LogOnInfo[0].ConnectionInfo.Password = "12";
           crystalReportViewer1.LogOnInfo[0].ConnectionInfo.DatabaseName = System.Environment.CurrentDirectory + "\\db.mdb";
           crystalReportViewer1.LogOnInfo[0].ConnectionInfo.ServerName = System.Environment.CurrentDirectory + "\\db.mdb";
       }
   }
}

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,
my question is how must I write in the program so that the box doesnt come out.

thanks
 

Users who are viewing this thread

Back
Top Bottom