locked
crystal report and two table RRS feed

  • Question

  • User-1698479530 posted

    hi 

    i have two table in my dataset and in my statement im request two table, the problem here is one of the table showing only the other is not

      Dim rptDoc As New ReportDocument
                            Dim ds As New accessdb
    
                            Dim sqlCon As SqlConnection
                            Dim dt As New DataTable
    
                            sqlCon = New SqlConnection(ConfigurationManager.ConnectionStrings("str").ConnectionString)
    
                          
                            Dim da As New SqlDataAdapter("select shipment.*,Registration.* from Registration,shipment", sqlCon)
                            da.Fill(dt)
                            ds.Tables(0).Merge(dt)
    
                            rptDoc.Load(Server.MapPath("myreport.rpt"))
    
                            rptDoc.SetDataSource(ds)
                            reportgenereted.DisplayGroupTree = False
                            reportgenereted.ReportSource = rptDoc

    Wednesday, July 15, 2015 4:19 PM

Answers

  • User-271186128 posted

    Hi almahmeed205,

    As for this issue, I suggest you set a break point to check the two tables and make sure they all contains values. And check the Table structure to make sure they have largely similar schemas.

    Besides, I suggest you could also check the values in the two tables and make sure they doesn't contains the same primary key value. Because, when merging a new source DataTable into the target, any source rows with a DataRowState value of Unchanged, Modified, or Deleted, is matched to target rows with the same primary key values. Source rows with a DataRowState value of Added are matched to new target rows with the same primary key values as the new source rows.

    For more details, please refer to DataTable.Merge Method: https://msdn.microsoft.com/en-us/library/fk68ew7b(v=vs.110).aspx

    Best Regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 16, 2015 9:47 PM