I'm trying to solve columns not all appearing in reportviewer/rdlc in VB.NET
I have the code below, but this is still wrong.
is there any other method please guide me
Thanks
Public Class Form2
Dim tps As New Tableproductservice()
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim form2 = New Form3()
Dim rds = New ReportDataSource("DataSet1", tps.Loaddata("A"))
form2.ReportViewer1.LocalReport.DataSources.Clear()
form2.ReportViewer1.LocalReport.DataSources.Add(rds)
form2.ReportViewer1.LocalReport.ReportEmbeddedResource = "transposerowtocolumnsqlmsaccessvbnet.Report1.rdlc"
form2.ShowDialog()
End Sub
Public Class Tableproductservice
Private connectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\transposerowtocolumnsqlmsaccessvbnet.accdb;Persist Security Info=False"
Dim sql = <sql>
TRANSFORM Sum(Tableproduct.[Qty]) AS SumOfQty
SELECT Tableproduct.Codeproduct AS [CodeProduct], Tableproduct.Colour AS [Colour],Sum(Tableproduct.Qty) AS [Total]
FROM Tableproduct INNER JOIN SizeProduct ON Tableproduct.Size = SizeProduct.Size
WHERE Tableproduct.Codeproduct = ?
GROUP BY Tableproduct.Codeproduct, Tableproduct.Colour
PIVOT SizeProduct.Size;
</sql>.Value
Using _conn = New OleDbConnection(connectionString)
Return _conn.Query(Of Tableproduct)(sql, New With {Key .CodeProduct = CodeProduct}).ToList()
End Using
End Function
End Class
Public Class Tableproduct
Public Property CodeProduct() As String
Public Property Colour() As String
Public Property S() As Integer
Public Property M() As Integer
Public Property L() As Integer
Public Property XL() As Integer
Public Property Total() As Integer
End Class
Public Class SizeProduct
Public Property Size() As String
Public Property Sequence() As Integer
End Class
below screenshot of results from code above
Desired Result :
Where For Codeproduct : A
| CodeProduct | Colour | S | M | L | TOTAL |
|---|---|---|---|---|---|
| A | Black | 20 | 20 | ||
| A | White | 15 | 10 | 25 |
Where For Codeproduct : B
| CodeProduct | Colour | S | XL | TOTAL |
|---|---|---|---|---|
| B | Blue | 20 | 20 | |
| B | White | 15 | 15 |


As per this link the solution
Here's a link!
and Here's a link!
First right click on the column and select "Column Visibility"
Choose "Show or hide base on an expression"
and set an expression for each column