BUG: VB Dynasets Incorrectly Bypass Defaults on SQL Server (101522)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q101522 SYMPTOMS
When inserting a row into a SQL Data Source using dynasets, you may see
one of the following behaviors: - The row is not inserted due to a NON-NULL integrity conflict.
- The row is inserted but the default for a column is bypassed.
The behavior depends on the table definition (can it be made NULL or not)
for the default-bound column. If default(s) exist on the table in SQL
Server and the dynaset column corresponding to the default-bound column
is not given a value before the insert, one the behaviors listed above will
occur:
CAUSE
On the Update method for the Dynaset, the following SQL code is generated
by Jet Engine used by both Microsoft Access and Visual Basic version 3.0:
Insert into Customer (Name, City) values ("bob", NULL)
For example, look at the schema definition shown in the More Information
section below. If the table definition is as in A, the Insert fails because
it is an attempt to insert NULL into a non-null column. If the table
definition is as in B, the Insert command inserts "bob" and Null into the
table -- bypassing the default of "Seattle" for City
To correct the problem, the Jet Engine should construct the SQL Statement
to enforce defaults:
Insert into Customer (Name) values ("bob")
This would correctly insert "bob" and "Seattle" into the Customer table.
STATUS
Microsoft has confirmed this to be a bug in Visual Basic version 3.0. We
are researching this problem and will post new information here in the
Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 10/28/2003 |
---|
Keywords: | kbbug KB101522 |
---|
|