Michael Tot Korsgaard
Michael Tot Korsgaard

Reputation: 4014

WebMatrix set Insert_Identity on

I've made a database in WebMatrix. And i've set the isIdentity true but the table wont auto increment. It gives me an error saying that "Insert_Identity is off".

How do I turn it on?.

The SQL code that I used to create the table

create table Product
(
    _ID integer identity not null,
    primary key(_ID),
    unique(_ID),
    Name varchar(50) not null
)

And here is how my GUI looks like enter image description here

Then I try added data to the table enter image description here

And the the error happens. I've got no clue on whats going on

Upvotes: 0

Views: 980

Answers (1)

jompi
jompi

Reputation: 360

I'm having the same issue, I've been looking for and I found this

Webmatrix 3 Sql Server CE 4 Busted?

It says that webmatrix3 doesn't support DB GUI interaction.

That's the answer about your question... Hope it helps in my case it did. You can create, show the data,etc with basic MySQL commands. Furthermore...

When I/someone create a sql script it creates the table with no problems at all. U should not have problem with that either.

OTHERWISE, when you insert values from the webpage, the error comeback :( and that I cannot find why...

This is just an example of what i did.

var db = Database.Open("db");
var insertCommand = "INSERT INTO Driver(Name, LName, DNI) VALUES(@0, @1, @2)";
db.Execute(insertCommand, Name, LName, DNI);
Response.Redirect("~/Driver");

I AM WRITING THIS BECAUSE you/someone just might have the same problem LATERRR in your webpage AND SOMEONE WILL complete the answer, because creating the tables like I said before with a sql script u should have no problem at all, but, inserting from the form, I think the AUTOINCREMENT is the problem because it shows an error about the PK ...(in most of the cases I've been reading).

Hope it helps, also I read to comeback WebMatrix2 :( ...

Upvotes: 1

Related Questions