Microsoft Knowledge Base Email Alertz

(255997) - 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.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 255997 - Last Review: November 25, 2003 - Revision: 2.2

PRB: Unable to Set Default Property of Column Object Using ADOX

This article was previously published under Q255997

On This Page

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  (http://kbalertz.com/Feedback.aspx?kbNumber=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.

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 Enterprise Edition for Windows 6.0
Keywords: 
kbbug kbprb KB255997
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate