Showing posts with label country. Show all posts
Showing posts with label country. Show all posts

Friday, February 24, 2012

How to retieve data using cellset

Dim cs as cellset
cmd = con.CreateCommand()
cmd.CommandText = "Select [Geography].[Geography].[Country].&[United States] ON ROWS, [Date].[Calender Year].[Calender Year] ON COLUMNS FROM [Adventure Works]"
cs = cmd.ExecuteCellSet()
Dim tuplesOnColumns As TupleCollection
tuplesOnColumns = cs.Axes(0).Set.Tuples
Dim column As Tuple
For Each column In tuplesOnColumns
result.Append(column.Members(0).Caption, "/t")
Next column
Response.Write(result.ToString)

i cannot get anydata when i run this , my connection with the database is good can anyone help me how to get the data using cellset

hello Aravind,

i think an example below should work:

Dim cs As CellSet
Dim cmd As AdomdCommand

cmd = con.CreateCommand()
cmd.CommandText = "Select [Geography].[Geography].[Country].&[United States] ON ROWS, [Date].[Calendar Year].members ON COLUMNS FROM [Adventure Works]"

cs = cmd.ExecuteCellSet()

Dim result As StringBuilder
result = New StringBuilder()

Dim tuplesOnColumns As TupleCollection
tuplesOnColumns = cs.Axes(0).Set.Tuples

Dim column As Tuple

For Each column In tuplesOnColumns

result.Append(column.Members(0).Caption)
result.Append("\t")

Next column

System.Diagnostics.Debug.WriteLine(result.ToString())

hope this helps some,