I wrote a report using Crystal Reports XI linked to an Access database here C:\\MyData.mdb.
The report has one field (simplified for this example) and no sub-reports.
DOes this WePos thing have the correct right to read from to folder/location in your filesystem or do you need elevated rights or something to read from this location. Could be the same issue when you connect to a remote network folder. Then you also have to specify the credentials on that computer to get access to it. Does this make sense?
Public Sub giveLogin()
Dim conInfo As New ConnectionInfo
conInfo.ServerName = ConfigurationManager.AppSettings("ServerName")
conInfo.DatabaseName = ConfigurationManager.AppSettings("DatabaseName")
conInfo.UserID = ConfigurationManager.AppSettings("UserID")
conInfo.Password = ConfigurationManager.AppSettings("Password")
For Each tblLogon As TableLogOnInfo In CrystalReportViewer1.LogOnInfo
tblLogon.ConnectionInfo = conInfo
Next
End Sub
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" HasCrystalLogo ="False" EnableDatabaseLogonPrompt ="false" EnableParameterPrompt ="false" />
this works for me,
var rd = new CrystalReport1();
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = @"d:\testing\test2.mdb";
connectionInfo.UserID = "admin";
foreach (Table table in rd.Database.Tables)
{
TableLogOnInfo logonInfo = table.LogOnInfo;
logonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(logonInfo);
}
crystalReportViewer1.ReportSource = rd;
Just for future reference, if you ever switch to SQL Server you will want to use SQL OLEDB and NOT the native Sql Client or you will run into the same problem again as I also did when I was first integrating CR into our app. It will work fine on your development machine but not in production.
In Crystal Reports XI (possible on all version I'd imagine) I changed the Database Type from Access/Excel (DAO) to OLE DB (ADO).
I bet if I had persisted I could have set the location of the System.mdw
against the reports Datasource Location in the C# code (see above), as indicated by David.
So many thanks David for the top notch steer towards the cause of this exceptionally 'niche' problem - I hope it helps someone else!
Added on behalf of the OP.