steve_rm
Oct 26th, 2006, 08:13 PM
Hello,
I am using VS 2005 and CR 10. I have using typed dataset. However, I have a problem displaying the data in the report. I have created an typed dataset.xsd called DS_JobSheet.xsd. I have previewed the data and it displays everything. I have created the reports.
In the report I have select database expert / project Data / ADO.Net Dataset. I have select my dataset and selected the table.
I have dragged the fields on to the report. I think everything seems to be ok here.
The code for filling the report is below. I have added a grid to the report to see if that gets filled and it does. I just don't understand why my report does not show any data.
I have imported
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.Shared
Can any correct if I have done something wrong.
Many thanks,
Steve
Private Sub frmJobSheet1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim customerReport As New rptJobSheet1()
Dim DS_JobSheet As DataSet 'DS_JobSheet is the .xsd data schema, data has been generated
Dim IDNumber As Integer
Dim cnn As New SqlConnection()
Dim da As New SqlDataAdapter()
Dim cmd As New SqlCommand()
cnn.ConnectionString = "server=steve02\ssd02; database=serviceMaster; pwd=a123; user id=sa"
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * FROM Incident"
DS_JobSheet = New DataSet
Try
cnn.Open()
cmd.Connection = cnn
da.SelectCommand = cmd
da.Fill(DS_JobSheet)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
IDNumber = 68 'Display record for ID number 68 this number exists in the database table
customerReport.SetDataSource(DS_JobSheet)
Me.CrystalReportViewer1.Refresh()
Me.CrystalReportViewer1.SelectionFormula = "{Incident.IncidentID} = " & IDNumber & " "
Me.CrystalReportViewer1.ReportSource = customerReport 'Application.StartupPath & "\JobSheetReport\rptJobSheet1.rpt"
Me.UltraGrid1.DataSource = DS_JobSheet.Tables(0).DefaultView 'Data is displayed in the datagrid so this is ok
Me.UltraGrid1.Refresh()
Me.CrystalReportViewer1.Show()
End Sub
I am using VS 2005 and CR 10. I have using typed dataset. However, I have a problem displaying the data in the report. I have created an typed dataset.xsd called DS_JobSheet.xsd. I have previewed the data and it displays everything. I have created the reports.
In the report I have select database expert / project Data / ADO.Net Dataset. I have select my dataset and selected the table.
I have dragged the fields on to the report. I think everything seems to be ok here.
The code for filling the report is below. I have added a grid to the report to see if that gets filled and it does. I just don't understand why my report does not show any data.
I have imported
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.Shared
Can any correct if I have done something wrong.
Many thanks,
Steve
Private Sub frmJobSheet1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim customerReport As New rptJobSheet1()
Dim DS_JobSheet As DataSet 'DS_JobSheet is the .xsd data schema, data has been generated
Dim IDNumber As Integer
Dim cnn As New SqlConnection()
Dim da As New SqlDataAdapter()
Dim cmd As New SqlCommand()
cnn.ConnectionString = "server=steve02\ssd02; database=serviceMaster; pwd=a123; user id=sa"
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * FROM Incident"
DS_JobSheet = New DataSet
Try
cnn.Open()
cmd.Connection = cnn
da.SelectCommand = cmd
da.Fill(DS_JobSheet)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
IDNumber = 68 'Display record for ID number 68 this number exists in the database table
customerReport.SetDataSource(DS_JobSheet)
Me.CrystalReportViewer1.Refresh()
Me.CrystalReportViewer1.SelectionFormula = "{Incident.IncidentID} = " & IDNumber & " "
Me.CrystalReportViewer1.ReportSource = customerReport 'Application.StartupPath & "\JobSheetReport\rptJobSheet1.rpt"
Me.UltraGrid1.DataSource = DS_JobSheet.Tables(0).DefaultView 'Data is displayed in the datagrid so this is ok
Me.UltraGrid1.Refresh()
Me.CrystalReportViewer1.Show()
End Sub