hi

i designed an application in Visual Studio 2008 that uses crystal reports. When i run the application in Visual Studio, the application generates the reports with no problem. After packaging and installation though, a Just In Time Exception is called when a user tries to generate a report.

the problem is with your connection string but first tell me how are you accsesing the data to the crystal reports ? is it by bound or unbound means. If unbound then you have to show me the code but my guess is you need to get your connection string from your appconfig file and it would be something like this:
Dim sqlcon As String = My.Settings.assettrackerConnectionString
Dim cnQS As SqlClient.SqlConnection
cnqs= new SqlClient.SqlConnection(sqlcon)
hope it helped good luck

Here is the code i used to access the tables in a access DB. There is also the issue of the merge modules required for Crystal reports in VS 2008. Got CRRuntime_12_0.msm and added it to my setup files but still an error appears. Hope the problem is in my code.

Imports System.Data.OleDb
Public Class RentRpt
    Dim Da As New OleDbDataAdapter
    Dim Dt As New DataTable
    Dim Report As New Rent



    Private Sub RentRpt_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        

       
        Com.CommandText = "Select COUNT(*) As RowCount from Report"
        Dim RowCount As Integer
        RowCount = CInt(Com.ExecuteScalar)

        If RowCount <> 0 Then

            Com.CommandText = "INSERT INTO InvoiceRec (tenantName, houseType, rate, months, amount, dateissued) SELECT tenantName, houseType, rate, months, amount, dateissued FROM Report"

            Com.ExecuteNonQuery()
            Com.Parameters.Clear()

        End If

        Com.CommandText = "Delete * from Report"
        Com.ExecuteNonQuery()
        Com.Parameters.Clear()
    End Sub

    Private Sub RentRpt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Com.CommandText = "Select * from Report, Housing where Report.tenantName='" & RentPreview.cboTenant.Text & "' AND Housing.type=Report.houseType"
        Da.SelectCommand = Com
        Da.Fill(Dt)
        Report.SetDataSource(Dt)
        CRV.ReportSource = Report
        CRV.Show()



    End Sub

    Private Sub rent_InitReport(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rent.InitReport

    End Sub
End Class
This article has been dead for over six months. Start a new discussion instead.