VB.net crystal report

cs_beabea Messages postés 62 Date d'inscription vendredi 10 octobre 2003 Statut Membre Dernière intervention 17 octobre 2008 - 17 juin 2005 à 14:04
cs_Creat Messages postés 76 Date d'inscription dimanche 25 juillet 2004 Statut Membre Dernière intervention 20 mars 2006 - 17 juin 2005 à 17:24
Bonjour,

avant j'avais l'habitude de faire des Cr sous VB6 mais avec VB. net, je suis un peu perdue

J'ai créé mon dataset fortement typé et ajouter un nouvel élément crystal report. Je l'ai créé avec l'expert. Ensuite, j'ai créé une form et mis un CRviewer mais là je coince, je ne sais pas où mettre mon code et le lequel pour lancer mon report et lié les donnés du dataset;

merci pour votre aide
Béatrice

1 réponse

cs_Creat Messages postés 76 Date d'inscription dimanche 25 juillet 2004 Statut Membre Dernière intervention 20 mars 2006
17 juin 2005 à 17:24
Voici comment je le fais:


''Engine library used for basic calls to the Crystal Reports engine
Imports CrystalDecisions.CrystalReports.Engine

''Shared library used for database logon and passing datasets
Imports CrystalDecisions.Shared



Private
Sub AfficheRapport(
ByVal sPath
As
String,
ByVal SQLString
As
String,
ByVal sTable
As
String)

Dim oRPT
As
New ReportDocument
'Ca provient de CrystalDecisions.CrystalReports.Engine
Dim objConnection
As
New OleDbConnection(ConnString)

Dim objDataAdapter
As OleDbDataAdapter

Dim objDataTable
As DataTable


oRPT.Load(sPath) 'sPath = c:\mes documents\test.rpt
objConnection.Open()

'Retrieve the data using the SQL statement and existing connection
objDataAdapter =
New OleDbDataAdapter(SQLString, objConnection)



'Fill the dataset with the data retrieved. The name of the table
'in the dataset must be the same as the table name in the report.
objDataAdapter.Fill(objDataSet, sTable)
objConnection.Close()



'Pass the populated dataset to the report
oRPT.SetDataSource(objDataSet)



'Set the viewer to the report object to be previewed.
crRapport.ReportSource = oRPT



End
Sub
0
Rejoignez-nous