Microsoft KB Archive/255997

From BetaArchive Wiki

Article ID: 255997

Article Last Modified on 11/25/2003



APPLIES TO

  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
  • Microsoft OLE DB Provider for Jet 4.0
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition



This article was previously published under Q255997

SYMPTOMS

When attempting to set the Default property of an ADOX column object using the Microsoft Jet 4.0 provider, the value is not set. No error message is generated. Trying to change the Default property removes any existing Default value already in place.

RESOLUTION

To work around this problem, you can execute an ALTER TABLE command to accomplish the same functionality. For example, to add a default value to MyColumn in MyTable, use the following command:

ALTER TABLE MyTable ALTER COLUMN MyColumn SET DEFAULT 'DefaultValue'
                

STATUS

Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.

This problem was corrected in Jet 4.0 Service Pack 5.

For additional information about how to obtain the latest Jet 4.0 service pack, click the following article number to view the article in the Microsoft Knowledge Base:

239114 How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine


MORE INFORMATION

Steps to Reproduce Behavior

  1. In Microsoft Visual Basic 6.0, open a new Standard EXE project. Form1 is created by default.
  2. On the Project menu, select References, and add a reference to the items below:Microsoft ActiveX Data Objects 2.5

    Microsoft ADO EXT. 2.5 for DDL and Security

  3. Place the following code in the Form1 Code module:

    Private Sub Form_Load()
    Dim cnn As New ADODB.Connection
    Dim cat As New ADOX.Catalog
    
    cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\Vb98\nwind.mdb"
    cat.ActiveConnection = cnn
    cat.Tables("Order Details").Columns("Quantity").Properties("Default") = 99
    'assuming a numeric field
    MsgBox cat.Tables("Order Details").Columns("Quantity").Properties("Default")
    End Sub
                        
  4. Run the project.Results: The message box is empty.

    Note This behavior only occurs when you use the Microsoft Jet 4.0 Provider that ships with MDAC 2.5.


Keywords: kbbug kbprb KB255997