Exporting data from remote SQL Server to local SQL Express

One method I have started to use during development is to run a local SQL Express server along with the local running web server for developing and testing. Firstly I could not manage the local SQL Express using Enterprise Manager as I expected to and had to download SQL Server Management Studio Express (which is actually a good free tool).

I came across a problem which took me a while to sort out and wasn’t very obvious. The problem came up when using Enterprise Manager and wanting to export to my local SQL Express server. Enterprise Manager defaults by refering to the local DB as ‘local’, which I thought would be fine but this did not work. What I found is that you must refer to the local SQL Express DB by using:

<machine name>/SQLEXPRESS

In my case my local machine is called CYBER1 so:


Exporting to SQL Express

(SQLEXPRESS being the default name created during installation of SQL Express Server)

ASP.Net -> object does not exist in the current context – really??

Another one of those problems that can stump you for a while. I often make backups of files as I progress and sometimes leave them in the website folder, this was fine with classic ASP but as I have found with ASP.Net can cause all sorts of problems.One issue I was having was trying to reference a component in my aspx page from the codebehind page and seeing the following error when trying to reference a label control:

“Label2 does not exist in the current context”

So I found that the problem was even though I renamed one of my old files it still contained the class that my codebehind was referencing (i.e. the class names were still the same) – and therefore was not seeing the newly added Label control to my new code.Shame the compiler doesn’t realise the duplication and give some indication.

Lesson: Remove any backed up files from the web folder and/or build directory to avoid pain 🙂

From a comment made by Chris (below) this can also be caused by a missing files if it was built as a ‘Web Application’ project and you are now trying to build it as a ‘Web Site’ project (e.g. could be missing a designer.cs file).

Either when downloading source from another developer or migrating a web app from one server to another you may find it was actually created as a ‘Web Application’ project in Visual Studio, and if you have created it as a ‘Web Site’ project you may hit problems. The solution to this is to convert the project to a ‘Web Application’ (right click on your project in solution explorer) and then rebuild it.

ASP.Net beware the rogue ‘form’ tag!

I have just spent 3 evenings trying to resolve an issue with an ASP.Net datagrid and getting the updated values from the cells in the OnRowUpdating event.After trying every conceivable possible method of getting the values under the sun I find that the cause of these missing values was one ‘form’ tag with ‘method=”post”‘ sitting in the HTML of my master.master page and screwing up the postback

Damn that was a hard lesson to learn!