Microsoft KB Archive/266302

= PRB: ADOX Error -2147217859 &quot;Type Is Invalid&quot; When You Append a Table to a Catalog =

Article ID: 266302

Article Last Modified on 8/23/2001

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q266302



SYMPTOMS
When you use ADOX to append a new table to an ADOX catalog, you may receive the following error message:

Runtime error: '-2147217859 (80040e3d)':

Type is invalid.



CAUSE
This problem occurs because providers can accept only recognized data types for the columns in the table. Each provider is different and specific to the database format in which it is stored.



RESOLUTION
To resolve this problem, use a data type that the provider supports. The following list includes the data types that each provider supports:


 * When you use the adNumeric data type with Microsoft Jet 4.0 and Microsoft SQL Server 7.0, you must set precision.



Steps to Reproduce Behavior
 In Visual Basic, create a new Standard EXE project. Form1 is created by default. From the Project menu, click References, and then click '''Microsoft ADO Ext. 2.1 for DDL and Security'''. Place a CommandButton control (Command1) onto Form1.  Paste the following code onto the Declarations section of Form1: Private Sub Command1_Click

Set cat = New ADOX.Catalog Set tbl = New ADOX.Table cat.ActiveConnection = _ &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Nwind.mdb;&quot; tbl.Name = &quot;TestTable&quot; tbl.Columns.Append &quot;ValidColumn&quot;, adInteger tbl.Columns.Append &quot;InvalidColumn&quot;, adDBTimeStamp cat.Tables.Append tbl End Sub  Modify the &quot;cat.ActiveConnection&quot; property so that it points to a valid Microsoft Access database file. Run the project, and press Command1. You receive the above-mentioned error because the Jet provider does not support the adDBTimeStamp data type.</li></ol>

<div class="references_section">