cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to retrieve data from database Vendor Code 2812

Former Member
0 Kudos

Sir, i have Installed the Crystal Reports for Visual Studio.Net 2010 (CRforVS_13_0_4) and created many reports, those reports are working fine with the following code as long as my PC is same where i have created the report. (Reports are created with Stored Procedures in backend)....But when i moved to another PC all reports are giving error.

"Failed to retrieve data from database"

Details: [Database Vendor Code 2812]

Error in File ItemTypesReport (ItemTypes Report is the Crystal Report)

Following is my code.

Public Sub Preview_ReportWithParameters(ByVal CrystalReportName As String)

        Try

            If SqlConn.State = 1 Then SqlConn.Close()

            Dim frmReport As New ReportDisplay

            Dim crDocument As New ReportDocument

            Dim reportPath As String = My.Application.Info.DirectoryPath + "\" + CrystalReportName + ".rpt"

            crDocument.Load(reportPath)

            crDocument.SetParameterValue("@UserID", Convert.ToInt64(mUserID))

            crDocument.SetParameterValue("@ActionCode", "1")

            crDocument.SetParameterValue("@SearchText", "")

            Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo()

            crConnectionInfo.ServerName = mSQLServername

            crConnectionInfo.DatabaseName = mSQLDatabaseName

            crConnectionInfo.UserID = mSQLUser

            crConnectionInfo.Password = mSQLPassword

            Dim crTables As Tables = crDocument.Database.Tables

            For Each crTable As CrystalDecisions.CrystalReports.Engine.Table In crTables

                Dim crTableLogonInfo As TableLogOnInfo = crTable.LogOnInfo

                crTableLogonInfo.ConnectionInfo = crConnectionInfo

                crTable.ApplyLogOnInfo(crTableLogonInfo)

            Next

            frmReport.crViewer.ReportSource = Nothing

            frmReport.crViewer.DataBindings.Clear()

            frmReport.crViewer.ReportSource = crDocument

            frmReport.Show()

            frmReport.Refresh()

            SqlConn.Close()

            'crDocument.Dispose()

        Catch ex As Exception

            'If Err.Number = 5 Or Err.Number = 91 Then

            '    MsgBox("Sorry, no record is selected to preview, you must select a record.", MsgBoxStyle.Information, "No record selected")

            'Else

            MsgBox("Error No: " & Err.Number & vbNewLine & ex.ToString, MsgBoxStyle.Information, "No record selected")

            'End If

        End Try

    End Sub

To Call the above Procedure

Preview_ReportWithParameters("ItemTypesReport")

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Malik,

Error codes are simply passed from the DB Client through CR.

Error 2812

Severity Level 16
Message Text

Could not find stored procedure '%.*ls'.

Looks like it's either a permission issue or the DB Client is not configured on the test PC.

What DB Server are you using and which driver, ODBC, OLED or Native? And what dll are you using in your connection method?

Don

Answers (0)