When checking on the dataset I can see its getting the data from the database but its not displaying it on crystal report
here's what I got:
Dim conn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=""|DataDirectory|\DB.mdf"";Integrated Security=True;Connect Timeout=30;User Instance=True")
Dim cmd As New SqlCommand()
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet
Dim strReportName As String
cmd.Connection = conn
conn.Open()
ds.Clear()
cmd.CommandText = "SELECT * FROM maestras WHERE (maestras.nombre LIKE N'%" & TextBox1.Text & "%')"
da.Fill(ds, "nombre")
strReportName = "CrystalReport2"
Dim strReportPath As String = Application.StartupPath & "\" & strReportName & ".rpt"
If Not IO.File.Exists(strReportPath) Then
MsgBox("Error al cargar el reporte", MsgBoxStyle.Critical, "Error")
'Throw (New Exception("Imposible encontrar el reporte" & vbCrLf & strReportPath))
conn.Close()
Exit Sub
End If
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptdocument.Load(strReportPath)
rptdocument.Refresh()
rptdocument.SetDataSource(ds.Tables(0))
rptViewer.ShowRefreshButton = False
rptViewer.ShowCloseButton = False
rptViewer.ShowGroupTreeButton = False
rptViewer.ReportSource = rptDocument
rptViewer.Refresh()
conn.Close()

New Topic/Question
Reply




MultiQuote




|