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
|
Public Class Form1
Inherits System.Windows.Forms.Form
Dim cn As OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand
Dim myAdapter As OleDb.OleDbDataAdapter
Dim rd As OleDb.OleDbDataReader
Dim MonEtat As MediaApplication.ReportContact
Dim paramCmd As OleDb.OleDbParameter
Dim DataContact As MediaApplication.DatasetContact
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
Friend WithEvents CRViewer As CrystalDecisions.Windows.Forms.CrystalReportViewer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.CRViewer = New CrystalDecisions.Windows.Forms.CrystalReportViewer
Me.SuspendLayout()
'
'CRViewer
'
Me.CRViewer.ActiveViewIndex = -1
Me.CRViewer.Location = New System.Drawing.Point(8, 8)
Me.CRViewer.Name = "CRViewer"
Me.CRViewer.ReportSource = Nothing
Me.CRViewer.Size = New System.Drawing.Size(560, 368)
Me.CRViewer.TabIndex = 0
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(576, 382)
Me.Controls.Add(Me.CRViewer)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
cn = New OleDb.OleDbConnection("Provider=sqloledb;Data Source=SRVDATA01;Initial Catalog=BASE_MEDIA;Integrated Security=SSPI")
'On récupère les data
Me.DataContact = New MediaApplication.DatasetContact
Me.myAdapter = New OleDb.OleDbDataAdapter("select nom, prenom,organisme from t_contact", cn)
'!! ERREUR: DataSetContact ets un type et ne peut etre utilisé en tt qu expression
myAdapter.Fill(DatasetContact)
'On passe les données ds le rapport
Me.MonEtat = New MediaApplication.ReportContact
Me.MonEtat.SetDataSource(Me.DataContact)
CRViewer.ReportSource = Me.MonEtat
CRViewer.Refresh()
Me.DataContact.Clear()
Me.DataContact.Dispose()
End Sub
End Class |
Partager