Wednesday, September 14, 2011

Saving changes is not permitted in SQL 2008 Management Studio

I am working on one of my project and i need to change the table design for change requirement, i done the changes and tried to save the table but SQL server throws an error message as described below:

"Saving changes is not permitted. The changes you have made require the following table to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created."

How to solve this issue?

  1. Go to Tools > Options it will open the Options dialog.
  2. Select the Designers from left pane
  3. Un check the Prevent saving changes that require table re-creation
  4. Press OK button.













This will allow you to save the table changes.

Possible causes for this error:

  1. You tried to change the data type of any column and the table already have some data exists.
  2. You tried to add constraint to any column like Primary key which already have data exists.
thanks and regards.



Monday, June 6, 2011

Visual Studio crashing when opening XAML (WPF) files

Before some months i develop one project in WPF, now i got new requirements from client i start working on that change but what i see when i try to open XAML visual studio crashed. I was shocked what happened because few months ago everything was fine.

I did lots of goggling to solve the issue, believe me i search for 2 days. finally i found a solution here

what you need to do is run the visual studio command prompt and enter "ngen/ delete *" (exclude the quotes). it will remove all assemblies native images. It will remove corrupted assemblies too.

It worked for me.
Thanks to Pale Musings.

Tuesday, March 8, 2011

How to use Session variable in Asp.net web service

In order to use Session variable in asp.net web service you need to add
EnableSession=true attribute in web method definition.

[WebMethod(EnableSession=true)]
public void HelloUser()
{
return "Hello " + Convert.ToString(Session["LoggedInUser"]);
}

Thursday, February 24, 2011

Align a div center of page vertically and horizontally

Today i need to align a div center in page horizontal as well as verticle.


css :
body
{
font-size: 14px;
font-family: verdana, helvetica, sans-serif;
color: #333;
}
p
{
margin: 2em;
}

#centerdiv
{
position: absolute;
top: 50%;
left: 50%;
width: 50em;
height: 26em;
margin-top: -13em; /*set to a negative number 1/2 of your height*/
margin-left: -25em; /*set to a negative number 1/2 of your width*/
border: 1px solid #ccc;
background-color: #f3f3f3;
}


html is :

Wednesday, February 23, 2011

List of Simple Quality Checks while developing a software or web site

15 Basic QC points to check while developing the software / web application.

In today’s world software development is very rapid process. There are very tight deadlines which need to meet by developers. Usually developers finish the development but after it delivered to QC team developer get a big list of bugs find by qc team. And then developer needs to solve bug list overnight which is very tedious job. Herewith I tried to list out common qc points which developer can check at the time of development which make his/her life easier. Hope it will helpful to developers.

  1. Proper tab index of every field in all the pages.
  2. There should be * near mandatory field. And a note in bottom of page which mention that * fields are mandatory / compulsory.
  3. Set the max length property of every input field in a page so that user can’t enter longer text in field.
  4. There should be at least one default button (i.e. Save / Submit etc.)
  5. In windows application every entry form should be close when user press escape key.
  6. There should be product icon on top left corner or every page in case of windows application.
  7. Numeric fields should not accept alpha characters.
  8. Use proper validation for email addresses, phone numbers etc.
  9. During development please check the junk character entry like ', @, #, $ etc. it should be pass on insert, update, record fetching etc.
  10. In case of listing – details page scenario listing page should have features like sorting, paging, search by all required columns, go to page etc.
  11. Every master entry should be entered during transaction form (i.e. if your transaction form has combo box which contain master data then there should be a + button near combo box, user should be able to press this button and that button should open particular master page after inserting new master entry it should be selected in given combo box.)
  12. Use of try .. catch block. Developer should use try catch block on every event handler where user can interact. Also user should not get unhandled exception, there should be proper message to user in case of any exception and that error should be logged in some text file on user’s machine / server in case of web based application.
  13. Use proper validation for avoiding duplicate master entries.
  14. Referential integrity should be maintain, means when user tries to delete any master entry system should check for the existence of referential data in transactions and should give proper message to user. Then take action like deactivate the master or remove all referential transactions whatever best suits as per the requirements of software.
  15. Every field should have a tooltip which can help user to understand the role of that field in the page.

validation of viewstate mac failed in asp.net

Before some days the error "Validation of viewstate MAC failed" became my great enemy.
I done lot's of googling to resolve the problem.
I found some good links in which they show some ways to prevent this error one of them is
http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx
Hard luck with me, i tried tips shown in above link which did not work for me, finally after lots of efforts i found the root cause for that error. My all websites were hosted on shared server and they did not alocated dedicated application pool, so most of web sites were on default application pool and hosting people has done setting which recycles that pool every 5 minutes. so when the page got post back after interval of more than 5 minutes application pool get recycled and server raise above error
Validation of viewstate MAC failed.

So finally we decided to buy a dedicated server for our websites and i set dedicated application pool for each website with proper settings so that it does not recycled every 5 minutes.

Finally i got the solution for above error and now me and our clients are happy.


Resources : Asp.net, c#, mysql, iis6.0