问题
Ok, when I create a sql server CE .sdf database in the new Webmatrix 3 I run into a problem. I've narrowed an example down to this.
1) I create a table called test. One column "test_ID" is a bigint, primarykey, and an identity. 2) I create another column called "test_desc" which is a nvarchar(50) with all the defaults.
Problem.
I cannot insert data using the GUI. Something about the column name cannot be modified. This is very annoying and somewhat disappointing for a new release to have such a huge bug just off the get go. Anyone else run into this or have a work around? I could write a SQL statement for the inserts, that might work. But then why have a GUI?
Also, I created a new database with webmatrix 3 and the problem still existed (original site was created with Webmatrix 2 and the data entry GUI worked fine with Webmatrix 2 on tables that do now not accept inserts with Webmatrix 3).
Also I did an uninstall and reinstall just for laughs, no love.
回答1:
I was faced today with the same problem. Already had a CE database prior to upgrading to WebMatrix 3, and I was no more able to insert new data even on existing tables as they have a column with a primary key and identity. I've come out with a solution until Microsoft releases a patch to overcome the situation. Try the following if you need to insert new rows with data.
- In Home open a new Query document.
- Insert a dummy row with some data with a line similar to the following: INSERT INTO tablename (columnname) VALUE ('dummydata')
- Execute the query
A new row is created with dummy data (or with valid data if you are willing to) and a value is automatically generated for the primary key. Now, if you need, you can go and edit the row and fill it with the values you want. Repeat query execution if you need more rows.
Hope this somehow helps.
Regards
来源:https://stackoverflow.com/questions/16392844/webmatrix-3-sql-server-ce-4-busted