Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: DataReader and DLL Post Reply Post New Topic
Author Message
CIWGeorge
Newbie
Newbie


Joined: 15 Jun 2009
Location: United States
Online Status: Offline
Posts: 3
Quote CIWGeorge Replybullet Topic: DataReader and DLL
    Posted: 15 Jun 2009 at 2:15pm
I tried following the examples in Crystal Reports Encyclopedia, Volume 2 (Listing 17-13 and 17-15) to create a DLL, then use the Database Expert in a blank report to connect to the DLL.
 
Crystal Reports gives me:  "Logon failed.  Details: mscorlib : Exception has been thrown by the target of an invocation."
 
What am I doing wrong (details below)?
 
Thank you in advance for your assistance!
 
-------------------------------------------------------------
 
My DLL created in Visual Studio 2008 is:

  Imports System.Data

  Imports System.Data.OleDb

  Public Class CM_Wizard

    Public Shared Function Get_Wizard_1() As IDataReader

      Dim str_OleDB_Connection_Provider As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\!CV Share\CV_GDF.mdb'"

      Dim str_Select As String = "SELECT * FROM tblPartClasses_3_5"

      Dim myOleDBConnection As OleDbConnection = New OleDbConnection(str_OleDB_Connection_Provider)

      myOleDBConnection.Open()

      Dim myOleDBCommand As OleDbCommand = New OleDbCommand(str_Select, myOleDBConnection)

      Dim myIDataReader As IDataReader = myOleDBCommand.ExecuteReader

      Return myIDataReader

    End Function

  End Class

----------------------------------------------
 
Within Crystal Reports 2008:
 
  • Open blank report.
  • Open Database Expert.
  • Select 'ADO.NET (XML)' -> Make New Connection.
  • Open "CM_Wizard.dll".
  • Select Class Name "CM_Wizard.CM_Wizard".
  • "CM_Wizard.CM_Wizard" appears under 'ADO.NET (XML), with "Get_Wizard_1" below it.
  • The icon next to "Get_Wizard_1" is a box with three rows of waves.
  • Double-click on "Get_Wizard_1" and I get the mscorlib error message.
 
------------------------------------------------
 
 George


Edited by CIWGeorge - 15 Jun 2009 at 2:17pm
IP IP Logged
CIWGeorge
Newbie
Newbie


Joined: 15 Jun 2009
Location: United States
Online Status: Offline
Posts: 3
Quote CIWGeorge Replybullet Posted: 15 Jun 2009 at 3:22pm
Cockpit error.
 
The data table referenced in the SQL needs to exist before the DLL will work - doh!
 
Correcting the reference allows the DLL to work as advertised.  CR2008 and VS2008 are once again in harmony.
 
George
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.035 seconds.