A Spinner Control in C#

For tasks of an undeterminable length, we see ‘spinners’ being used to indicate that something is in progress and that our applications haven’t stopped. I needed one, and so knocked one up:

Read more

Using in-line delegates for logging

Any work you have to do to collate infomation destined for a log is wasted effort if that logging is switched off or otherwise configured such that your log message will never be output. Read more

Identifying Predefined Roles on SQL Server Reporting Services 2005 (SSRS)

I was given the task of writing some code to add a user or group to a role on a SQL 2005 Express Edition Reporting Services server.

The natural answer to the problem of giving users access to a Reporting Services server is to create your own roles for which only the required Tasks are allowed.

Creating roles is not allowed as it is a limitation of Express Edition. So – your best bet is to find the most suitable predefined role to assign your user / group to.

The single biggest issue I found in trying to do this was identifying the predefined roles.
Read more

Adding a column with DataType VarBinaryMax using SMO

I have discovered that the following code does not behave as expected…

Table someTable = database.Tables["some_table"];
Column someColumn = new Column (someTable, "some_column", DataType.VarBinaryMax);

This code will actually add a column of type varbinary(1) to the database. The following works…

Column someColumn = new Column (someTable, "some_column", DataType.VarBinary(-1));

Oh well.

InternalsVisibleTo Attribute Compiler Error CS1726

I’ve decided to use the InternalsVisibleTo assembly attribute to give access to some internal classes to a unit testing project.I added the attribute to my project, and I got this CS1726 compiler error. I duly googled for a solution, and discovered that (unsurprisingly) many people came across this error after strong naming their assembly.

The thing was that none of my assemblies were strong named. It turns out that the problem was due to the presence of the following attributes in my AssemblyInfo.cs file:

[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

I commented them out and hey-presto, everything worked as expected. I think the presence if these attributes is a hang-over from VS2003. They don’t seem to be generated by default in VS2005 Assembly Info files.