D
Douglas Buchanan
== Description ==
VB.Net will unfaithfully represent primary keys when they are
identified as an IDENTITY field for SQL Server tables. I will make
these mistakes when producing Insert Stored Procedures and when
producing DataSets. It will NOT make these mistakes when the field is
'ID', but it WILL create these mistakes when the field is named other
than 'ID' for example 'CustID'.
The mistakes in the Insert Stored procedure are:
• The id will not be recognized as an IDENTITY
• The id will be included as a parameter to be assigned a value by the
user
• The id will be included in the insert into statement and the Values
statement (as if a value will be assigned to it by the user)
• The id will be included in the select statement of the insert stored
procedure
• The WHERE statement of the Insert stored procedure will have a
parameter for the id equal to its parameter (CustID = @CustID) not
(CustID = @@IDENTITY)
The mistake in the DataSet is:
• The id field's AutoIncrement property is set to FALSE
This mistake will be seen in the DataGrid:
• The ID will shown as NULL
• You will not be able to enter data into the table
I can provide instruction on how to duplicate this error.
VB.Net will unfaithfully represent primary keys when they are
identified as an IDENTITY field for SQL Server tables. I will make
these mistakes when producing Insert Stored Procedures and when
producing DataSets. It will NOT make these mistakes when the field is
'ID', but it WILL create these mistakes when the field is named other
than 'ID' for example 'CustID'.
The mistakes in the Insert Stored procedure are:
• The id will not be recognized as an IDENTITY
• The id will be included as a parameter to be assigned a value by the
user
• The id will be included in the insert into statement and the Values
statement (as if a value will be assigned to it by the user)
• The id will be included in the select statement of the insert stored
procedure
• The WHERE statement of the Insert stored procedure will have a
parameter for the id equal to its parameter (CustID = @CustID) not
(CustID = @@IDENTITY)
The mistake in the DataSet is:
• The id field's AutoIncrement property is set to FALSE
This mistake will be seen in the DataGrid:
• The ID will shown as NULL
• You will not be able to enter data into the table
I can provide instruction on how to duplicate this error.