Skip to Content
0

[SAP B1 HANA]Crystal Reports - Failed to retrieve data from the database

May 03, 2017 at 09:33 AM

79

avatar image

Hi experts, I'm trying to preview a report using crystal report viewer in Visual Studio. I'm using SAP B1 version for HANA. Below is my code, but I've received Database Vendor Code 328:

    Dim cryRpt As ReportDocument
    Dim logonProps As NameValuePairs2

cryRpt = New ReportDocument
cryRpt.Load(xPath & "\BIR Reports\APP_GENERAL_LEDGER_orig.rpt")
Dim SAPVersion As String = oCompany.Version.ToString
Dim oUsername As String = oCompany.UserName 
Dim oUserid As String = oCompany.UserSignature 
cryRpt.SetParameterValue("DateFrom", oDates1 & " 00:00:00")
cryRpt.SetParameterValue("DateTo", oDates2 & " 00:00:00")
cryRpt.SetParameterValue("FROMDATE", oDates1)
cryRpt.SetParameterValue("TODATE", oDates2)
cryRpt.SetParameterValue("SAPVersion", SAPVersion)
cryRpt.SetParameterValue("Username", oUsername)
cryRpt.SetParameterValue("Userid", oUserid)
logonProps = cryRpt.DataSourceConnections(0).LogonProperties
'logonProps.Set("Provider", "HDBODBC32")
'logonProps.Set("Server Type", "HDBODBC32")
logonProps.Set("Connection String", "DRIVER={HDBODBC32};UID=SYSTEM;PWD=P@ssw0rd;SERVERNODE=" & oCompany.Server & ";DATABASE=" & oCompany.CompanyDB & ";")
'logonProps.Set("Locale Identifier", "1033")
cryRpt.DataSourceConnections(0).SetLogonProperties(logonProps)
cryRpt.DataSourceConnections(0).SetConnection(oCompany.Server, oCompany.CompanyDB, "SYSTEM", "P@ssw0rd")
CrystalReportViewer1.EnableRefresh = True
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
cryRpt.Close()
cryRpt.Dispose()
crystal.jpg (26.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers