Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All

Please Tell me PIVOT TALBE WORKING. And Dynamic PIVOT TABLE how to WORK in VB.NEt..

I Don't Have more Idea for That..so Please tell me U Advice. for That..
Posted

1 solution

Read about SQL PIVOT:
MSDN: Using PIVOT and UNPIVOT[^]
Understanding PIVOT and UNPIVOT[^]
Pivoting data in SQL Server[^]


About working in VB.NET or C#, it's about ADO.NET - how to use/access database through code - create connection and pass on command with queries and parameters to get back data.

Learn about Pivot, write one as per need and then use ADO.NET in VB.NET to call the query and get result for disply.

Try!
 
Share this answer
 
v2
Comments
Navas Khanj 9-Feb-13 14:51pm    
Thanks
Sandeep Mewara 9-Feb-13 14:53pm    
Welcome.
Navas Khanj 9-Feb-13 14:56pm    
i need one more help..
Sandeep Mewara 9-Feb-13 15:00pm    
Please post a new question for another one.
Navas Khanj 9-Feb-13 14:59pm    
Dim strSQL27 As String = "SELECT [FeesType] FROM FeeMaster WHERE Class='" & cboClass.Text & "'" '
Dim DaAp27 As New SqlDataAdapter(strSQL27, con)
Dim Dset27 As New DataTable
DaAp27.Fill(Dset27)


Dim VF As Object
For i = 0 To Dset27.Rows.Count - 1
VF = Dset27.Rows(i).Item("FeesType")
' MessageBox.Show(VF)
Dim strSQL11 As String
strSQL11 = "SELECT * FROM (SELECT SA.Regno, SA.Sname, SA.Class, SA.Section , FT.FeeType," & _
" FT.Amount_Paid,SA.mobile1 FROM Fees_Transaction as FT INNER JOIN stdAdmission as SA ON FT.Regno=SA.Regno) FeeMaster" & _
" PIVOT (Sum(Amount_Paid) for FeeType in ( [" + VF + "] ))as PVT where Class='" & cboClass.Text & "'"
Dim DaAp11 As New SqlDataAdapter(strSQL11, con)
Dim DSet11 As New DataTable
DaAp11.Fill(DSet11)

DGV1.DataSource = DSet11
Next

Above Code I USE "PIVOT (Sum(Amount_Paid) for FeeType in ( [" + VF + "] ))as PVT

if any Other Way to Get Table Field..?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900