Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Failed login on client Post Reply Post New Topic
Author Message
Aidanb
Newbie
Newbie


Joined: 16 Apr 2012
Online Status: Offline
Posts: 3
Quote Aidanb Replybullet Topic: Failed login on client
    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

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
 
IP IP Logged
Aidanb
Newbie
Newbie


Joined: 16 Apr 2012
Online Status: Offline
Posts: 3
Quote Aidanb Replybullet 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
IP IP Logged
Aidanb
Newbie
Newbie


Joined: 16 Apr 2012
Online Status: Offline
Posts: 3
Quote Aidanb Replybullet 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

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.033 seconds.