Friday 6 August 2021

Getting Microsoft SQL Azure Migration Wizard working in Windows 10

To install Microsoft SQL Azure Migration Wizard you need a very specific version of Microsoft.Sqlserver.SMO (Version 12 of server management objects)

This library needs to be installed in your global assembly cache (c:\windows\assembly\) in order to work properly and for the azure migration tool to pick it up. 

To install every version of Microsoft.Sqlserver.smo plus the other libraries, you can install the SQL Server Data Tools package, which is here: https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-ver15 

You can find the source code for the SQL Azure Migration Wizard here: https://github.com/adragoset/SQLAzureMigration 

I've been using version 5.15.6.0 of the Migration tool.

Friday 20 February 2015

asp:DropDownList - invalid postback or callback argument

I was getting this exception when selecting what looked like a perfectly valid ASP.NET drop down list option.

This error is usually caused by something changing the contents of the drop down before postback, which gets .NET very confused.

In my case, it was due to white space in some of the drop down entries being bound. Using String.Trim() cleared this up.

Strangely, changing from a .NET drop down to a standard drop down (select tag) caused my getters to fetch an empty string instead of my value.

This sort of thing happens a lot with Umbraco properties, because quite a few of them are auto-padded with white space. Calling Trim() is a good practice in situations where you think you might get unnecessary padding.

Monday 9 June 2014

Fire an event using JQuery with a delay

Sometimes when you're building some javascript to validate a field, you don't necessarily want that field to be constantly re-evaluated. An example of this is when you're validating a password. You want to make sure that the password is valid after the user's finished entering it, but you don't really want them to have to click a 'validate' button. Wouldn't it be neater if it just evaluated it 'on the fly'? Most password validation tools also have a nice progress bar that changes colour when you start producing more sensible passwords, going from scary red to calming green. If your bar changed colour after every key press, it'd become a quite cumbersome and CPU-intensive process. This is where bindWithDelay comes in! Using this example, the registered event will wait until the user lifts their finger and does nothing further within this field for one second prior to running the password validation function. This super-handy little plugin is available courtesy of http://briangrinstead.com.

Monday 26 May 2014

The E_INVALIDARG Visual Studio warning

I had a very strange compilation error occur the other day that was preventing me from starting my .NET project.

It read:

ASP.NET runtime error: Could not load file or assembly 'xxxx.yyyyy.zzzzzz, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxx' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

Fix

Shut down IIS and Visual Studio, then clear the contents of all "C:\WINDOWS\Microsoft.NET\Framework\vx.x.x\Temporary ASP.NET" folders.

I found the fix for this problem on a MSDN blog article.

Monday 12 May 2014

Microsoft SQL Server Migration Assistant for MySQL does NOT support SQL Server Express!

Fairly recently, I was given a MySQL database and told that I needed to use the bulk of this data to power a web application that was using Microsoft SQL Server.

The first major task with this was finding a way of getting the tables across to a SQL Server format that I could work with, and I'd deal with the actual process of getting the data into my database later using a load of custom scripts.

I decided on using the Microsoft SQL Server Migration Assistant for MYSQL to do the heavy work for me, and now that I know what can go wrong with this process, I'd recommend that most users take this route.

Notes

Every time I ran the conversion tool on a database, the MSSQL Agent shut down

Don't use MS SQL Server Express edition as the destination DBMS. Make sure you use a fully qualified version of SQL Server; Developer Edition did it for me. You need a full version because SQL Server Express shuts the SQL Server Agent down and won't let it start again - Trying to get it started again is a RED HERRING. You think that the agent is stopping you from doing a successful import, but it's just one of many reasons. Get the proper version of SQL Server, and this will work straight away.

Nullable columns after creating the schema

Once the schema has been created within MSSQL, it's time to import data into your newly created tables. For some reason, when the migration assistant created the SQL Server tables, it didn't make the columns that needed to be nullable, well, nullable. So you have to do that by hand. The easiest way to spot it is when your migration falls over because it's trying to insert a null value into your table.

Get the MYSQL ODBC plugin

You can get a list of ODBC plugins at the MYSQL website. This is how MYSQL and MSSQL know how to talk to each other.

Monday 28 April 2014

Slow publishing times on Umbraco sites and the Umbraco SiteMapProvider

When publishing large amounts of content within Umbraco, I've noticed that the publishing process could easily time out, and I was wondering what was causing it. I found out that the UmbracoSiteMapProvider was the cause of the problem, and I gather that a sitemap was being constructed in the background, and subsequent errors and warnings were being left in the log. This was using up vital publishing time. To fix this, I commented this out of my web.config: My suspicions of its uselessness in general use were confirmed by this comment from the Umbraco issues log. If you're using an older version of Umbraco where this hasn't been done, feel free to comment it out and see your publishing times for large amounts of content reduce considerably!

Wednesday 13 February 2013

Get a list of countries for a dropdown

This is a surprisingly difficult question to answer, as it's not all as simple as just adding the System.Globalization namespace and getting stuck in.

It appears that there are in fact a large amount of incorrect / incomplete answers on the subject.

There is a web service that you could add and call which may prove to be more up-to-date than the .NET framework itself, but the easiest, fastest and WORKING method of adding countries to a drop-down is to use the method mentioned in this StackOverflow question:

It's a life-saver!