Sunday, 24 February 2013

LINQ to SQL – ‘Row not found or changed‘


This System.Data.Linq.Changeconflictexception with the message ‘Row not found or changed‘ appears to be a very annoying bug or error, but this is not the first time that i am getting this error while updating database record with Linq to SQL on ASP.NET. I tried to re-drag SQL tables from server explorer to the designer and rebuild the solution. I am still getting the ‘Row not found or changed’; there is a lack of details.
Reading on other blogs, found this from readme:
Tables with columns of type DateTime with higher precision than seconds do not update correctly. Blinq creates BoundField objects for DateTime fields that do not contain precision beyond seconds, so updates with DateTime fields with high precision that participate in optimistic concurrency fail. To fix this, do one of the following:
Change the precision displayed by the BoundField object by setting DataFormatString=”{0:o}”, HtmlEncode=false, and ApplyFormatInEditMode=true.
Designate the DateTime field as never participating in optimistic concurrency. See “Changing a Field’s Update Mode” earlier in this document to change the update mode for this column. Use this option carefully—removing this column from participating in optimistic concurrency will allow overwrites of the value to succeed even if the database’s value has been changed.

Wednesday, 6 February 2013

Installing ASP.NET Membership services database in SQL Server Express 2008


In this article i have briefly discussed ASP.Net SQL Server Membership database installation on SQL Server 2008 Express.
Environment: Visual Studio 2008; SQL Server 2008
Step 1:
  1. Run aspnet_regsql.exe utility fromC:\windows\Microsoft.NET\Framework\v2.0.50727 folder on your machine. Selecting or double clicking the aspnet_regsql.exe utility opens the wizard as below.
1
Selecting Next button on above window opens next window where you can either configure SQL Server for Application services or remove Application services information from an existing database.
Step 2:
Select configure SQL Server for application services radio button to install new database and select Next button.
2
Step 3
Enter your SQL Express server name as <your Machine name \SQL Express> as shown below. Note that you can change the application services database name to your desired name (aspnetdb by default).
Note that i named the database to ASPNETServices
3
Step 4:
Select Next button and confirm that your settings are correct to go further with installation (shown in below image) and select Next button.
4 
   Step 5
Selecting Next button on above window takes you to confirmation window as below after successful installation of your application services database for ASP.NET.
5 
Step 6
You will see installed ASPNET Services database ready to use within your ASP.NET application
6