Skip to Content
0
Former Member
Apr 09, 2013 at 09:30 PM

connecting to an old access (pre 2003) database with security.mdw file for login authentication

84 Views

Hi

I am new to the site and crystal reports. I am using crystal reports for vs 2010 and programming in c#

I have an old database which has user login credentials stored in a separate database (workgroup security?). I can connect to it via c# by passing the login details to the .mdw file and the main database in the connection string.

I can also (in design view) connect to the database and produce a report.

However when I try running the report at runtime, I am being asked for login details... and even after providing the details is does not connect..

I connect using this method in design time:

settings

but i cannot find any information on how to connect at runtime... Where do I set the session username, session password and system database?

my code to connect looks a bit like this:

ReportDocument cryRpt = new ReportDocument();

TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();

TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();

ConnectionInfo crConnectionInfo = new ConnectionInfo();

Tables CrTables;

string path = Application.StartupPath;

cryRpt.Load(path + "\\" + report);

crConnectionInfo.UserID = "someuser";

crConnectionInfo.Password = "password";

crConnectionInfo.ServerName = "z:\\main_database.mdb";

CrTables = cryRpt.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)

{

crtableLogoninfo = CrTable.LogOnInfo;

crtableLogoninfo.ConnectionInfo = crConnectionInfo;

CrTable.ApplyLogOnInfo(crtableLogoninfo);

}

if (parameter != "")

cryRpt.SetParameterValue(parameter, value);

crvMain.ReportSource = cryRpt;

I am losing the will to live trying to find the solution to this, can anyone help??

Cheers