IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

Création d'une UFL pour Crystal Report


Sujet :

Windows Forms

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Avril 2003
    Messages
    27
    Détails du profil
    Informations forums :
    Inscription : Avril 2003
    Messages : 27
    Par défaut Création d'une UFL pour Crystal Report
    Bonjour,

    J'ai suivi le tutoriel de msdn pour créer une UFL pour crystal report.
    C'est en fait une DLL qui sera disponible ensuite dans crystal.
    Je développe sous Visual Studio 2008 sp1.

    Mon message d'erreur à la compilation est :
    MSB3212*: L'assembly "E:\...\CRUFL_MBRPTOutils.dll" n'a pas pu être converti en bibliothèque de types. L'exportateur de bibliothèques de types a rencontré une erreur lors du traitement de 'CRUFL_MBRPTOutils.IExchangeUfl, CRUFL_MBRPTOutils'. Erreur*: Élément introuvable.
    Pouvez vous m'aider svp?

    Merci

    L'interface est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Imports System.Runtime.InteropServices
    <ComVisible(True), InterfaceType(ComInterfaceType.InterfaceIsDual), GuidAttribute("b56126c6-bd32-4464-8484-01fd96511f9b")> _
    Public Interface IExchangeUfl
        Function GetLibelleTraduit(ByVal idLibelle As Int32, ByVal idLangue As Int32) As String
    End Interface
    La Class est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    Imports Microsoft.VisualBasic
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Runtime.InteropServices
     
    <ComVisible(True), ClassInterface(ClassInterfaceType.None), GuidAttribute("57efc420-0ffc-40d7-8f58-21723ffaa8d5")> _
    Public Class CRUFL_MBRPTOutils : Implements IExchangeUfl
     
     
        Private strCatConn As String = Nothing
        Private ConnCat As SqlConnection = Nothing
        Private trCat As SqlTransaction
        Private strErrMsg As String = Nothing
        Private cmdCat As SqlCommand = Nothing
     
     
        Public Sub New()
            Me.strCatConn = "Data Source=MB-XP;Initial Catalog=CatWeb;Integrated Security=True"
     
            Connect()
        End Sub
     
     
        Public Function Connect() As Boolean
            If Me.strCatConn Is Nothing Then
                Throw New Exception("La chaine de connexion n'a pas été spécifié")
            End If
            If Me.ConnCat Is Nothing Then
                Try
                    Me.ConnCat = New SqlConnection(Me.strCatConn)
                    Me.ConnCat.InitializeLifetimeService()
     
                Catch ex As Exception
                    System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
                    Me.strErrMsg = ex.Message
                    Throw New Exception(ex.Message)
                    Return False
                End Try
            End If
     
            Try
                If ConnCat.State <> ConnectionState.Closed Then
                    ConnCat.Close()
                End If
                ConnCat.Open()
            Catch ex As Exception
                System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
                Me.strErrMsg = ex.Message
                Throw New Exception(ex.Message)
                Return False
            End Try
            Return True
        End Function
     
        Public Function Disconnect() As Boolean
            If Not Me.ConnCat Is Nothing Then
                Try
                    Me.ConnCat.Close()
                Catch ex As Exception
                    System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
                    Me.strErrMsg = ex.Message
                    Return False
                End Try
                Return True
            Else
     
                Return True
            End If
        End Function
     
        Public Sub Dispose()
            Finalize()
        End Sub
     
        Public Function GetLibelleTraduit(ByVal idLibelle As Int32, ByVal idLangue As Int32) As String Implements IExchangeUfl.GetLibelleTraduit
            Dim strSQL As String
     
            Dim strC As String = ""
     
            strSQL = "SELECT dbo.TRIM(dbo.GetLibelleTraduit(" + idLangue.ToString + ", " + idLibelle.ToString + "))"
            Dim dr As DataTableReader = GetDataSet(strSQL).CreateDataReader
            If dr.HasRows Then
                dr.Read()
                strC = dr(0).ToString.Trim
            End If
            dr.Close()
     
            Return strC
     
        End Function
     
        Protected Overrides Sub Finalize()
            Try
                Disconnect()
                Me.ConnCat.Dispose()
                Me.ConnCat = Nothing
                Me.strErrMsg = Nothing
                MyBase.Finalize()
     
            Catch ex As Exception
                System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
            End Try
     
        End Sub
     
        Private Function GetDataSet(ByVal strSQL As String) As DataSet
            If Connect() Then
                Dim ds As New DataSet
                Try
                    Dim rd As New SqlDataAdapter(strSQL, ConnCat)
                    rd.Fill(ds)
                    rd.Dispose()
                Catch ex As Exception
                    System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
                    Me.strErrMsg = ex.Message
                    Return Nothing
                End Try
     
                Disconnect()
                Return ds
            Else
                Return Nothing
            End If
     
        End Function
    End Class

  2. #2
    Membre averti
    Inscrit en
    Avril 2003
    Messages
    27
    Détails du profil
    Informations forums :
    Inscription : Avril 2003
    Messages : 27
    Par défaut
    J'ai viré les GuidAttribute et ça marche...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 6
    Dernier message: 24/04/2015, 09h10
  2. [AC-2010] Création d'une Base pour faire du reporting
    Par stephaccess dans le forum Requêtes et SQL.
    Réponses: 11
    Dernier message: 22/11/2013, 12h42
  3. Configuration imprimante matricielle pour Crystal Reports
    Par sakinaMejd dans le forum Périphériques
    Réponses: 2
    Dernier message: 30/09/2009, 15h44
  4. [musique] création d'une interface pour se simplifier la vie
    Par Christophe93250 dans le forum Access
    Réponses: 8
    Dernier message: 08/01/2006, 12h21
  5. Création d'une GDB pour Firebird
    Par ada_b dans le forum Débuter
    Réponses: 2
    Dernier message: 03/12/2004, 07h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo