Hi, everyone. I just started with WebMatrix and followed the tutorial examples. I used the UI to create a table (Movies). I set the following columns:
ID int primary key identity not null
Title nvarchar(50) not null
Genre nvarchar(30) not null
Year nchar(4) not null
I also created the table through the query window:
CREATE TABLE Movies
(
ID int IDENTITY (1,1) PRIMARY KEY NOT NULL,
Title NVARCHAR(50) NOT NULL,
Genre NVARCHAR(30) NOT NULL,
Year NCHAR(4) NOT NULL
)
But when I tried to enter the following data:
Title = Ironman 3, Genre = Action, Year = 2013
The following warning pops up:
Invalid Data
Your change could not be committed to the database.
After you click OK you can fix the invalid entry or
press the Esc key to cancel your changes.
The column cannot be modified. [Column name =
ID]
For some reason the Is Identiy not working either by creating the table by UI or by query window.
It doesn't let me insert a value on ID and it isn't auto generating the number. Any help would be appreciated.
You can't insert into the ID column because it's an autogenerated Identity column. If you want to insert, make sure you're not including that column any where in your query. It's not designed to be inserted into. It's autogenerated to guarantee uniqueness.
Thank for your reply Mike. I tried downloading from that link but it doesn't get installed. The following message displays after trying to intall it:
Microsoft Web Platform Installer couldn't find the product you tried to install. Either the link you clicked is incorrect or you may be overriding your feed with a different feed: To learn more about customs feeds and how to reset Microsoft Web Platform
Installer, click here.
That link takes me to the Webmatrix 3 download page. If in that page I click the link for WebMatrix 2, it brings the same page you linked me. Im not sure but apparently the setup of Webmatrix 2 doesn't work well for Windows 7 and up. The downloaded setup
is called WebMatrix2forVistaOrBelow.exe. Is there any other way to install WebMatrix 2?
None
0 Points
2 Posts
Identity property doesn't autopopulate fields
May 31, 2013 01:38 PM|emadel|LINK
Hi, everyone. I just started with WebMatrix and followed the tutorial examples. I used the UI to create a table (Movies). I set the following columns:
ID int primary key identity not null
Title nvarchar(50) not null
Genre nvarchar(30) not null
Year nchar(4) not null
I also created the table through the query window:
But when I tried to enter the following data:
Title = Ironman 3, Genre = Action, Year = 2013
The following warning pops up:
For some reason the Is Identiy not working either by creating the table by UI or by query window.
It doesn't let me insert a value on ID and it isn't auto generating the number. Any help would be appreciated.
Database sql WebMatrix
Contributor
2853 Points
1372 Posts
Re: Identity property doesn't autopopulate fields
May 31, 2013 01:51 PM|adamturner34|LINK
You can't insert into the ID column because it's an autogenerated Identity column. If you want to insert, make sure you're not including that column any where in your query. It's not designed to be inserted into. It's autogenerated to guarantee uniqueness.
Database sql WebMatrix
All-Star
194016 Points
28029 Posts
Moderator
Re: Identity property doesn't autopopulate fields
May 31, 2013 02:07 PM|Mikesdotnetting|LINK
There's a bug in the database tools in WebMatrix 3. You are better off uninstalling it and then installing WebMatrix 2: http://www.microsoft.com/Web/webmatrix/v2/
Database sql WebMatrix
None
0 Points
2 Posts
Re: Identity property doesn't autopopulate fields
May 31, 2013 03:21 PM|emadel|LINK
Thank for your reply Mike. I tried downloading from that link but it doesn't get installed. The following message displays after trying to intall it:
Microsoft Web Platform Installer couldn't find the product you tried to install. Either the link you clicked is incorrect or you may be overriding your feed with a different feed: To learn more about customs feeds and how to reset Microsoft Web Platform Installer, click here.
That link takes me to the Webmatrix 3 download page. If in that page I click the link for WebMatrix 2, it brings the same page you linked me. Im not sure but apparently the setup of Webmatrix 2 doesn't work well for Windows 7 and up. The downloaded setup is called WebMatrix2forVistaOrBelow.exe. Is there any other way to install WebMatrix 2?
Database sql WebMatrix
All-Star
194016 Points
28029 Posts
Moderator
Re: Identity property doesn't autopopulate fields
Jun 01, 2013 02:54 AM|Mikesdotnetting|LINK
You should take your question to the WebMatrix forum at http://forums.iis.net/1166.aspx
Database sql WebMatrix