SQL Server 2008: FIXED “Data has changed since the Results pane was last retrieved”

Today I was trying to edit the value in a table cell through the query browser in Microsoft SQL Server Management Itudio and I kept getting the following error:

Data has changed since the Results pane was last retrieved. Do you want to save your changes now?
(Optimistic Concurrency Control Error)
Click Yes to commit your changes to database anyway.
Click No to discard your change and retrieve the current data for this row.
Click Cancel to continue editing.

I would click “Yes”, and get another error:

No row was updated.
The data in row X was not committed.
Error Source: Microsoft.VisualStudio.DataTools.
Error Message: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows(N rows).
Correct the errors and retry or press ESC to cancel the change(s).

I was killing myself trying to figure out what was wrong. I was the only person working on the database, so the data wasnt being changed behind my back.

After an hour on goolge I came across a Microsoft tech article for MS SQL 2005, http://support.microsoft.com/kb/925719

It stated the issue could occure from one of the following conditions:

  • The table contains one or more columns of the text or ntext data type.
  • The value of one of these columns contains the following characters:
  • Percent sign (%)
  • Underscore (_)
  • Left bracket ([)
  • The table does not contain a primary key.

I double checked the table I was working on and realized it didnt have a primary key. It must have gotten dropped in the data migration from MS SQL 2000 to MS SQL 2008. A simple right click, set primary key and my problem was fixed.

Verify the primary keys! It’s a simple fix to a head breaker of a problem. I hope someone finds this and it fixes their issue.

I got a Drobo!

I have entered into a relationship with a new piece of high tech equipment, Drobo. Drobo is a self proclaimed “Data Robot”. In technical terms its a ASD (Attached storage device) running a custom version of RAID 5. When coupled with a DroboShare, it becomes a NAS (network attached storage) device.

In non tech terms, its an external harddrive that is expandable (up to 16 terabytes!) and can keep your data secure. The droboshare allows your computers to connect to it over your home network.

In the past I have blogged about how I love backups and how having good backups have saved my ass. The Drobo is the next evolution in my backup strategy.

I have recently moved away from my Windows Vista desktop and started to use my new Mac Book Pro as my main computer system. I eventually want to retire all the desktops on my network and run only laptops. I wanted to find a solution that was robust, expandable and allowed all of y computers to share a pool of data. After doing some research on popular NAS setups, I decided to go with Drobo.

One of the things that I liked about Drobo was how mindlessly easy it is to add more hard drives to the system. It’s so easy that I shot a video of myself adding a terabyte of storage in less then 30 seconds.

[youtube]http://www.youtube.com/watch?v=l4QlNkzyhlI[/youtube]

Right now I’m just testing the Drobo / DroboShare out. Once I get acquainted with it I’m sure there will be more blog posts.

follow up to my iPad predictions

So Apple has announced the iPad. This is a follow up to the predictions  I posted last week.

[youtube]http://www.youtube.com/watch?v=Msqc7I6rwLo[/youtube]

Things I was right about:

  • Apple will announce a tablet device
  • new version of the iPhone OS, 3.2.2
  • iPad will run on the iPhone OS
  • iPad will run iPhone applications
  • The iPad will have a 10 inch screen (9.7 inches is close enough)
  • 16, 32, 64 gig versions
  • Verizon will not be involved

Things I was wrong about:

  • There will be a new iPhone
  • The new iPhone will have a new camera. The iPad doesnt have any cameras!

How To detect an internet connection with the iPhone SDK

There are several ways to problematically detect if an iPhone has an internet connection, but most of them cant tell you how the iPhone is connected to the internet.

Apple has sample code to accomplish just this task. The Reachability class is not shipped with the SDK, but is part of a sample project of the same name. http://developer.apple.com/iphone/library/samplecode/Reachability/index.html

Using the reachability class:

Set up:

  • Download the reachability project from Apple
  • Copy Reachability.h and Reachability.m to your project.
  • Add the ‘SystemConfiguration’ framework to your project.

Sample Usage:

Reachability *reachability = [Reachability sharedReachability];
 [reachability setHostName:@"www.JoshHighland.com"];
 NetworkStatus remoteHostStatus = [reachability remoteHostStatus];

if(remoteHostStatus == NotReachable) {
 //no internet connection
 }
 else if (remoteHostStatus == ReachableViaWiFiNetwork) {
 //wifi connection found
 }
 else if (remoteHostStatus == ReachableViaCarrierDataNetwork) {
 //EDGE or 3G connection found
 }