Setting Up an ADOMD.NET Project
Posted by Michael in Programming on May 12th, 2009
I made my first foray into ADOMD.NET today. ADOMD.NET is the technology used to connect to SQL Server Analysis Services. It seemed to work pretty well. Here is the key to the castle:
using Microsoft.AnalysisServices.AdomdClient;
The first step is to make sure you have a login for the SSAS client. My server uses integrated Windows security, so I had to tack on the “Integrated Security=SSPI;” modifier to the end of the connection string.
AdomdConnection conn = new AdomdConnection("Data Source=THE_SERVER;Initial Catalog=THE_DB;Integrated Security=SSPI;");
Next up, open the connection and set up an ADOMD command with which to submit your MDX query:
conn.Open();
AdomdCommand cmd = new AdomdCommand(@"SELECT [Measures].[Count] ON COLUMNS, [Geography].[Geo].[All] ON ROWS
FROM [DBNAME]“, conn);
Use this command to fill a CellSet:
CellSet cs = cmd.ExecuteCellSet();
After this we can start slicing and dicing down to get the exact tuples we want. I recommend first creating a TupleCollection:
TupleCollection tuplesOnColumns = cs.Axes[0].Set.Tuples;
The cs.Axes[0].Set.Tuples refers to columns, whereas cs.Axes[1].Set.Tuples would refer to rows. I think this is a good stopping point, I”ll continue this later.
Javascript Linked List
Posted by Michael in Programming on May 7th, 2009
This is a simple Javascript LinkedList class that I built for a work project. Once you see the structure of the print() function, you should be able to add other functions such as find() or delete() very easily.
// Class LinkedList, by Michael Grimm, http://mgrimm.net
function LinkedList() {
this._root = null;
}
LinkedList.prototype = {
// ADD()
add: function(node) {
var curr = this._root;
if (curr == null) {
this._root = node;
} else {
while (curr.next != null) {
curr = curr.next;
}
curr.next = node;
}
},
// PRINT()
print: function(currPage, currFolder) {
var curr = this._root;
while (curr != null) {
// Put code to print here
curr = curr.next;
}
}
};
Hello world!
Welcome back, welcome back, welcome back.