After trying the number of methods, the problem is same - Whole project runs on my machine but in another machine where it is supposed to run, there all the pages show the records but when trying to show the print preview using the crystal reports, it shows the error - "Failed to load the Database Information".
The working logic of the project is that - When we want to print the information about the specific record, the selected index number gets captured and transferred to another form(.vb) where the data is fetched from the SQL Server database and stored in the empty table in a seperate new dataset inside the project. the crystal report then get those records stored in the table in the dataset and displays the records.
I have checked the datasource location from the "Database Expert" and it is the same location as needed.
My code inside the form is as follows -
Public Class ChemLabGradePrint
Public Sub New(ByVal GradeIndex1 As Integer)
Dim ff As New PourChemistryDataset.PourChemistryDataTable
Dim result As PourChemistrReportList
Dim SMin As String
Dim RMin As String
Dim RMax As String
Dim c As Integer result = New PourChemistrReportList(ReaderF(GetPourChemistryReport(GradeIndex1)))
For c = 0 To result.ElementName.Count - 1
If IsNumeric(result.SpecMin(c)) AndAlso CDbl(result.SpecMin(c)) <> 0 Then
SMin = result.SpecMin(c)
SMin = ""
If IsNumeric(result.RestrMin(c)) AndAlso CDbl(result.RestrMin(c)) <> 0 Then
RMin = result.RestrMin(c)
RMin = ""
If IsNumeric(result.RestrMax(c)) AndAlso CDbl(result.RestrMax(c)) <> 0 Then
RMax = result.RestrMax(c)
RMax = ""
'// Storing the records in empty table(manually built) in a PourChemistryDataTable table
SMin, result.SpecMax(c), RMin, RMax, result.Pref(c),
Dim RDoc As New ReportDocument
'// "METGrade" is the Parameter Field in the crystal report.rpt file
CrystalReportViewer1.ReportSource = RDoc
Then, the Crystal Report is set to the datasource location which is PourChemistryDataTable table and the data is displayed to the report.
All this process works well on my system but do not run in another system. The same Runtime Versions are installed and the read access is also given to access the .mdf file of SQL Server. The sql source of the project is set to automatic to get the sqlserver and the database information.
The CrystalReportViewer1.ReportSource in the Designer.vb is = >
Me.CrystalReportViewer1.ReportSource = "P:\ASW-Core-Shop_New\ASW-Core-1.1\Reports\ChemLabGradeReport.rpt"
It is set manually because it gives the error that "can not convert report.reportSource to String" so it is set to file location manually. The file location where the project is stored can be accessed to any computer within the factory because the drive is accessible to everyone. So, the file location for reportSource is accessible to everyone's system.