Friday, 11 April 2014

nullreferenceexception was unhandled in ASP.Net or C#

Hi Folks,
I got the below error

nullreferenceexception was unhandled

And I browsed so much for the solution....finally i understood that all I had to do was check the connectionstring name

i,e i had
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CCDBRegistrationString"].ConnectionString);

while the correct connection string name was

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CCDBConnectionString"].ConnectionString);

Cannot insert the value NULL into column 'id'? ASP.Net

Hi Folks,
If you get the below error while being a fresher in ASP.net ...

Cannot insert the value NULL into column 'id'?


Then please add identity property to your primary key

[ID] [int] Not NULL IDENTITY(1,1),


check the below link for more clarification
http://stackoverflow.com/questions/10013313/why-is-sql-server-throwing-this-error-cannot-insert-the-value-null-into-column