Print Page | Close Window

Failed login on client

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16187
Printed Date: 01 May 2024 at 7:48pm


Topic: Failed login on client
Posted By: Aidanb
Subject: Failed login on client
Date Posted: 16 Apr 2012 at 5:15am
Hi All,

I have got my crystal reports working on my development pc but when I try and deploy it, when i load a report it asks for login information, I am using VS 2010 and have an MS Access backend .mdb. I have tackled this problem before and used a typed dataset and oledbdataadapter and a fixed report, but I am loading the data from a sql statement pulled in from a xml file, then, this produces the dataset and the datatable which is then used as the datasource for the report. I chose this way as I want to be able to send reports to clients and they can load in to a file and away they go.

CrystalReport viewer
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class CrystalReportViewerForm
    Friend sSql As String
    Friend rptName As Object
    Friend ParamString As String
    Friend ParamName As String
 
 
    Private Sub CrystalReportViewerForm_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load
        Me.Icon = My.Resources.cheff
        CrystalReportViewer2.ShowLogo = False
        CrystalReportViewer2.ShowGroupTreeButton = False
        Try
            Dim rpt As New ReportDocument
            rpt.Load(Application.StartupPath + "\Reports\" + rptName.ToString + ".rpt")
            rpt.SetDataSource(ReportLoader.ReportData(sSql))
            CrystalReportViewer2.ReportSource = rpt
            CrystalReportViewer2.RefreshReport()
        Catch ex As Exception
            MessageBox.Show(ex.Message.ToString)
        End Try
    End Sub

This loads the data in to the dataset

 Public Shared Function ReportData(ByVal sql As StringAs DataSet         Dim cmd As OleDbCommand = New OleDbCommand()         Try             With cmd                 .Connection = Database.conn                 .CommandText = sql             End With             Dim ds As New RPTDataSet             Dim adapter As OleDbDataAdapter = New OleDbDataAdapter(cmd)             adapter.Fill(ds, "DataTable1")             ds.WriteXml(Application.StartupPath + "\Log_Files\Report.xml"XmlWriteMode.WriteSchema)             Return ds         Catch ex As Exception             Return Nothing             ErrorMsg.WriteMsg(ex, cmd.CommandText.ToString)         End Try     End Function

This is the database class which holds the connection string and works on the deployed machine just not with the report.

Imports System.Data.OleDb Public Class Database     Public Shared conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info= False; Data Source=" _     & Application.StartupPath & "\DataCatering.mdb;Jet OLEDB:Database Password=******")     End Class

Hope someone can help with this.

Regards

Aidan




Replies:
Posted By: hilfy
Date Posted: 16 Apr 2012 at 5:10pm
Does the machine that you're deploying to have the OLEDb drivers for access installed?  How about the .NET assembly for connecting to the drivers?  If not, that's what's causing your problem.
 
-Dell
 


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Aidanb
Date Posted: 16 Apr 2012 at 10:34pm
Hi Dell,

Thank you for the reply, I have office 2010 installed in and the database works ok and the system has .net 4.0 runtime installed on it. The system is pulling the data from the database as it is filling out in the forms I have produced. it is just when I try and load a report up it asks for the login credentials, I have had another look and when it is showing the logging screen it is only showing the server name as the RPTDataSet which is where I have the DataTable1 which has the columns for the report in them.

Regards

Aidan


Posted By: Aidanb
Date Posted: 18 Apr 2012 at 1:05am
hi i got this fixed I changed; for
Dim ds As New RPTDataSet for Dim ds As New DataSet
fixed it right up




Print Page | Close Window