Microsoft KB Archive/245341

= FIX: Visual Basic Crashes When Appending a New Column to an Existing Table =

Article ID: 245341

Article Last Modified on 11/17/2003

-

APPLIES TO


 * Microsoft Data Access Components 2.5
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q245341



SYMPTOMS
Microsoft Visual Basic crashes when appending a newly-created column to a table by setting the ParentCatalog property of a column to an active catalog and adding it to an existing table.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This problem has been corrected in MDAC 2.5 and later.



Steps to Reproduce Behavior
 Start a new Standard EXE project in Visual Basic. Form1 is created by default. Reference either the Microsoft ADO Ext. 2.5 for DDL and Security object library, or the Microsoft ADO Ext. 2.1 for DDL and Security object library. On the Tools menu, select Options. On the General tab, make sure you do not have Break on All Errors selected.  Double-click Form1. Copy and paste the following code in the Form_Load event: Private Sub Form_Load Dim cat As New ADOX.Catalog Dim col1 As New ADOX.Column Dim col2 As New ADOX.Column Dim tbl As New ADOX.Table cat.ActiveConnection = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb" On Error Resume Next cat.Tables.Delete "Table1" On Error GoTo 0 tbl.Name = "Table1" tbl.Columns.Append "Column1", adSmallInt cat.Tables.Append tbl col1.Name = "Column2" col1.ParentCatalog = cat col1.Properties.Refresh cat.Tables("Table1").Columns.Append col1   'VB crashed here End Sub Modify the Data Source path to point to a valid .mdb file.  Save and run the project. If you are using ADO 2.5, then the project completes successfully. If you are using ADO 2.1, then the application terminates abnormally.

Keywords: kbbug kbfix kbmdac250fix kbmdacnosweep KB245341

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.