Automatically generated updated/insert queries are based on the parameters
of the SELECT query. Since you are selecting both ID and name, the same
parameters end up in the generated queries. However, if ID is the primary
key (and you configured it to auto-increment in your DB), you don't need to
provide it as part of the insert query. A new ID will be generated
automatically when you insert a new record.
--
Kai Brinkmann [Microsoft]
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Serdge Kooleman" <Su***@web.de> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
i have a query: select id, name from Dictionary
field "id" is guid (so not null, and not identity)
i show only "name" in the dataGrid
how to set new id when i insert a new record?
currently VS wizard created insert command for me:
INSERT INTO Dictionary (id, name) VALUES (@id, @name );
SELECT id, name FROM Dictionary WHERE (id = @id)
it is not working "Column "id" doesn't allow nulls. Do you want to correct
the value?"
thank you