Okay, I have the following situation. I've got a table with a system generated key, but I have a need to insert a record and supply the key instead of letting the system generate it. If I were doing this in a .sql script, I'd simply set the insert identity on, do the insert, and then turn it off. Like this:

Code:
SET IDENTITY_INSERT dbo.Client ON
INSERT INTO dbo.CLIENT (ClientID, ClientName) VALUES (782, 'Edgewood Solutions')
INSERT INTO dbo.CLIENT (ClientID, ClientName) VALUES (783, 'Microsoft')
SET IDENTITY_INSERT dbo.Client OFF
A normal insert into this client table, as I'm doing the code now, looks like this (please forgive any typos, I'm generating this manually):

Code:
Dim ClientEntities As New ClientEntities()
Dim clientDB As New Client()
clientDB.ClientName= "Edgewood Solutions"
ClientEntities.Client.Add(clientDB);
The system automatically generates the ClientID value. What I WANT to do is provide the ClientID value using code like this:

Code:
Dim ClientEntities As New ClientEntities()
Dim clientDB As New Client()
clientDB.ClientName = "Edgewood Solutions"
clientDB.ClientID = 782
ClientEntities.Client.Add(clientDB);
However, as the database is set, this code will produce an error... I can't provide a value for the ClientID field. So, how do I do the equivalent of "SET IDENTITY_INSERT dbo.Client ON" in this code?