Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: change logon info at running time(ms access) Post Reply Post New Topic
Author Message
HSoft
Newbie
Newbie
Avatar

Joined: 27 Feb 2007
Location: China
Online Status: Offline
Posts: 8
Quote HSoft Replybullet Topic: change logon info at running time(ms access)
    Posted: 27 Feb 2007 at 9:16pm
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 :


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

Edited by HSoft - 27 Feb 2007 at 9:22pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Feb 2007 at 11:15pm
I haven't had a chance to do this in VS 2005 yet, but I do know that for MS Access you need to leave the .DatabaseName property blank. That property is only used for SQL Server databases.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
HSoft
Newbie
Newbie
Avatar

Joined: 27 Feb 2007
Location: China
Online Status: Offline
Posts: 8
Quote HSoft Replybullet Posted: 27 Feb 2007 at 11:43pm
thanks brian,

I left the .DatabaseName property blank, but that isnt the solution cause the problem still there,
but maybe you could try in 2003 as well (maybe it's the same for this problem)

thanks, any other opinion


IP IP Logged
HSoft
Newbie
Newbie
Avatar

Joined: 27 Feb 2007
Location: China
Online Status: Offline
Posts: 8
Quote HSoft Replybullet Posted: 27 Feb 2007 at 11:58pm
this is the error





Edited by HSoft - 27 Feb 2007 at 11:59pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.