Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/02/2004, 11:30
SilestreG
 
Fecha de Ingreso: febrero-2004
Mensajes: 3
Antigüedad: 21 años
Puntos: 0
Hola, estoy seguro que este ejemplo te servira, se pasa la informacion de conexion al reporte. En si, es un reporte basico que crea una instancia de un reporte llamado TenMostExpensiveProducts.rpt, el cual usa un procedimiento almacenado, solo basta con que pongas tu nombre de reporte. y definas los datos de conexion.


Private Sub btnPreviewBasicReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreviewBasicReport.Click
' In this event the Ten Most Expensive Products Report is loaded
' and displayed in the crystal reports viewer.

' Objects used to set the proper database connection information
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

' Create a report document instance to hold the report
Dim rptExpensiveProducts As New ReportDocument()

Try
' Load the report
rptExpensiveProducts.Load("..\TenMostExpensiveProd ucts.rpt")

' Set the connection information for all the tables used in the report
' Leave UserID and Password blank for trusted connection
For Each tbCurrent In rptExpensiveProducts.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = "tu servidor"
.UserID = "tu usuario del servidor"
.Password = "su contraseña"
.DatabaseName = "la basededatos usada"
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent

' Set the report source for the crystal reports
' viewer to the report instance.
crvBasic.ReportSource = rptExpensiveProducts

' Zoom viewer to fit to the whole page so the user can see the report
crvBasic.Zoom(2)

Catch Exp As LoadSaveReportException
MsgBox("Incorrect path for loading report.", _
MsgBoxStyle.Critical, "Load Report Error")

Catch Exp As Exception
MsgBox(Exp.Message, MsgBoxStyle.Critical, "General Error")

End Try
End Sub