Skip to Content
0
Former Member
Aug 09, 2016 at 11:52 PM

Looking for a sample project that demonstrates how use the RAS SDK

97 Views

I have downloaded xi4_rassdk_net_dg_en.chm, which shows what properties to set and methods to call using the RAS SDK, but it doesn't tell you where put the code.

I have also downloaded some sample projects from http://scn.sap.com/docs/DOC-50373, but cannot get the one I really want to see to work, which is how to add a table. I have also downloaded SAP Crystal Reports NET SDK Tutorial Sample Code from http://scn.sap.com/docs/DOC-6948, but the readme gives instructions to set up ODBC in the control panel. I'm running Windows 10, and I cannot find the settings the readme talks about.

Here is the code where the error occurs:

Public Class Form1

Dim boReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument

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

Dim boConnectionInfo As CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo

Dim boPropertyBag As CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag

Dim boPropertyBagConnection As CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag

Dim boTable As CrystalDecisions.ReportAppServer.DataDefModel.Table

boReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument()

boReportDocument.Load("C:\Crystal Reports\RAS SDK\Samples\Add Table\NET-VB2005-WIN_RAS-Unmanaged_CR12_Add_Database-Table\SimpleRCAPIReport.rpt")

Dim boReportClientDocument As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument = boReportDocument.ReportClientDocument

'This will add a database table using an ODBC connection. Since the report already has the Customer Table, we will add the Orders Table

'Create the DB connection

boConnectionInfo = New CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo

'Set new table logon properties

boPropertyBag = New CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag

'Because this is an ODBC connection to an access database, there is no need to specify the database

boPropertyBag.Add("DSN", "Xtreme Sample Database 2005")

'Set the connection info objects members

boPropertyBagConnection = New CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag

'1. Pass the Logon Properties to the main PropertyBag

'2. Set the Server Description to the new System DSN

'3. Set the Database DLL

boPropertyBagConnection.Add("QE_LogonProperties", boPropertyBag)

boPropertyBagConnection.Add("QE_ServerDescription", "Xtreme Sample Database 2005")

boPropertyBagConnection.Add("Database DLL", "crdb_odbc.dll")

boConnectionInfo.Attributes = boPropertyBagConnection

'Blank username and password since this database does not require them

boConnectionInfo.UserName = ""

boConnectionInfo.Password = ""

'The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).

boConnectionInfo.Kind = CrystalDecisions.ReportAppServer.DataDefModel.CrConnectionInfoKindEnum.crConnectionInfoKindCRQE

'Now create and add the table

boTable = New CrystalDecisions.ReportAppServer.DataDefModel.Table

boTable.Name = "Orders"

boTable.ConnectionInfo = boConnectionInfo

boReportClientDocument.DatabaseController.AddTable(boTable, Nothing) ' Get error here

boCrystalReportViewer.ReportSource = boReportDocument

End Sub

the error is in the attached file.


The sample is for VB 2005, could that be problem?

Thanks

Attachments

RAS Error 2.JPG (50.4 kB)