Hi all,
I've hit a snag that I can't seem to find the solution for - maybe one of you has come across this before and can help me out?
I've moved my Personal Web Site from SQLExpress into SQL 2005, and the tables look like they are set up correctly - the primary keys are there, as are the table structures etc, but I now get this error if I try and create a new album:
Cannot insert the value NULL into column 'AlbumID', table 'Personal.dbo.Albums'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'AlbumID', table 'Personal.dbo.Albums'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Source Error:
Line 161: command.Parameters.Add(New SqlParameter("@IsPublic", IsPublic))
Line 162: connection.Open()
Line 163: command.ExecuteNonQuery()
Line 164: End Using
Line 165: End Using
This used to work before, but now doesn't - from what I can gather from this it seems to be trying to create an album with an ID of null, instead of the next sequential number in the list of Album ID's?
What's the best way of getting around this?
Incidentally I created an album manually (through SQL manager etc) to test this, et voila it works, but then when you try and load a photo into it the same error occurs, as Photo ID it's trying is null too.
Any idea why it's trying a null insert now where it wasn't before?
Thanks,
David
David Clothier
If this answers to your question, please mark it solved/answered.