cancel
Showing results for 
Search instead for 
Did you mean: 

The field name is not known: Details: ErrorKind

Former Member
0 Kudos

Hello Everyone,

I'm trying to call my existing crystal report from VB.Net application. When I hit displayCR button on my form I get the below error message on one of the formula.

Is anything wrong with the below formula?

@DetailJobNumber

if{Invoice_Details_Prn.sJobNumber}<>{@fmlJob#}

and{Invoice_Details_Prn.sLineCode}in["1", "2", "6","7","Q","Q1"]

then{Invoice_Details_Prn.sDetail}

else{Invoice_Details_Prn.sDetail}

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

If you add that report to your Project and preview it in Visual Studio do you get the same error?

What have you done to debug this?

Does the formula work in CR Designer?

Have you logged onto the Datasource?

Don

Former Member
0 Kudos

Hi Don,

I was able to fix this error by modifying my sql statement. Now, I get another error message saying Failed to open the connection. I've also attached the screenshot to this message.

When I preview the report in Visual Studio it works fine. Only when I run my application I get the attached error message. I verified database and also set datasource location and everything looks fine. Nothing seem to fix this issue. Any help on this will be greatly appreciated. Thanks.

Regards,

Amol

0 Kudos

Well if it works in the Viewer then check your code... likely some property value is not correct or you may have multiple data sources etc.

Try had coding the log on info to verify it does get true values.

That error is passed from the Server through CR only, it's not something CR is generating. Unfortunately it is a generic error by the DB, it could be anything is wrong in the connection or SQL properties.

Don

Former Member
0 Kudos

Hi Don,

I tried hard coding the log on info in my code as well but still no luck. Getting the same error message. Below is my code:

Thanks,

Amol

Imports CrystalDecisions.CrystalReports.Engine

Imports System.Data.SqlClient

Imports CrystalDecisions.Shared


Public Class Form2


    Private Sub CrystalReportViewer1_Load(sender As System.Object, e As System.EventArgs) Handles CrystalReportViewer1.Load

        Try

            strsql = "Select * from InvoiceHeader H join InvoiceDetailsPrn D on D.sInvnumber=H.Invnumber where invnumber='703053'"


            Dim sqlda As New SqlDataAdapter(strsql, sqlconn)

            sqlda.Fill(sqlds, "table1")

            strreportname = "Report1"

            Dim strreportpath As String = Application.StartupPath & "\" & strreportname & ".rpt"

            If Not IO.File.Exists(strreportpath) Then

                Throw (New Exception("unable to locate file : " & vbCrLf & strreportpath))

            End If

            Dim rptdocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument

            rptdocument.Load(strreportpath)

            rptdocument.SetDatabaseLogon("sa", "test123", "laptop-10\localAV01", "AV01")

           

            rptdocument.SetDataSource(sqlds.Tables(0))

            CrystalReportViewer1.ReportSource = rptdocument

            CrystalReportViewer1.Refresh()


        Catch ex As Exception

            MsgBox(ex.Message)

        End Try

    End Sub

End Class

0 Kudos

Hi Amol,

Don't log onto the server for the report object if/when setting it to a Dataset so comment out this line:

rptdocument.SetDatabaseLogon("sa", "test123", "laptop-10\localAV01", "AV01")

It should simply be:

rptdocument.SetDataSource(ds);

And comment out the Refresh:

CrystalReportViewer1.Refresh()

If you don't then it's going to use the original info.

Don

Former Member
0 Kudos

Don,

I tried commenting the lines as you suggested but still get the same error message. I appreciate your quick response. Any other suggestions? Stuck with this for too long. Thanks.

Amol

0 Kudos

Add the table name and index back in then and see if that works.

rptdocument.SetDataSource(sqlds.Tables(0))

then add

foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{

}

crTable.TestConnectivity();

Make sure the connection is being taken. If this errors it's possible your table you are using is not the same as what is used in the Report itself which would throuw an error

Otherwise start putting a trace on your code and watch SQL server.

I know this works...

Don

Answers (0)