Create adTinyInt column with ADOX in SQLServer causes error

Create adTinyInt column with ADOX in SQLServer causes error

Post by Fabio Pagan » Wed, 04 Aug 1999 04:00:00



I am creating a new table in SQLServer 7.0 using ADOX 2.1 from VB6. When i
try to create a column of type adTinyInt, the program causes the following
error in the Catalog.Tables.Append method:
Run-time error '-2147217859 (80040e3d)': a specified type was invalid

It all works fine if i create a column with (for instance) the adInteger
type instead.

Here is the code:

-------
Private Sub Command1_Click()

Dim CnTo As New ADODB.Connection

Dim XCatalog As New ADOX.Catalog
Dim XTable As New ADOX.Table
Dim XColumn As New ADOX.Column

CnTo.Open "Provider=SQLOLEDB;User Id=sa;Initial Catalog=test1"

'Reference to the catalog
Set XCatalog.ActiveConnection = CnTo

'Create New Table
XTable.Name = "NewTable"
'Create New column
XTable.Columns.Append "NewColumn", adTinyInt
'Now Append the table (this gives the error)
XCatalog.Tables.Append XTable

End Sub
--------------------

Helps appreciated.

Fabio Pagano

 
 
 

Create adTinyInt column with ADOX in SQLServer causes error

Post by Richard Wakefiel » Wed, 04 Aug 1999 04:00:00


I don' have a problem using SQL to create tables with tinyint fields, I've
had problems with ADOX in many other places (such as creating date fields
when reading a date field from a Jet 351 database, type missmatch.)  I have
a funny feeling ADOX is not there yet.  It seems to me, and this is just my
opinion, that when ADO 2.0 came on the scene everyone complained there was
no syntax to manipilate database structure with ADO, so MS quickly put
together ADOX and shipped it with ADO 2.1.  I always wondered why ADOX is a
separate COM than ADO.  Whay was it not part of ADO like DAO?

Just my option, of course.

Richard

 
 
 

Create adTinyInt column with ADOX in SQLServer causes error

Post by Fabio Pagan » Wed, 04 Aug 1999 04:00:00


I have solved the problem using adUnsignedTinyInt instead of adTinyInt.

Thanks to the authors of www.able-consulting.com/ADODataTypeEnum.html

Fabio Pagano

Quote:Fabio Pagano wrote...
>I am creating a new table in SQLServer 7.0 using ADOX 2.1 from VB6. When i
>try to create a column of type adTinyInt, the program causes the following
>error in the Catalog.Tables.Append method:
>Run-time error '-2147217859 (80040e3d)': a specified type was invalid

>It all works fine if i create a column with (for instance) the adInteger
>type instead.

>Here is the code:

>-------
>Private Sub Command1_Click()

>Dim CnTo As New ADODB.Connection

>Dim XCatalog As New ADOX.Catalog
>Dim XTable As New ADOX.Table
>Dim XColumn As New ADOX.Column

>CnTo.Open "Provider=SQLOLEDB;User Id=sa;Initial Catalog=test1"

>'Reference to the catalog
>Set XCatalog.ActiveConnection = CnTo

>'Create New Table
>XTable.Name = "NewTable"
>'Create New column
>XTable.Columns.Append "NewColumn", adTinyInt
>'Now Append the table (this gives the error)
>XCatalog.Tables.Append XTable

>End Sub
>--------------------

 
 
 

Create adTinyInt column with ADOX in SQLServer causes error

Post by Kirk Allen Evan » Wed, 04 Aug 1999 04:00:00


It seems like the main reason is to keep the footprint smaller,
especially since Microsoft has focused so much more on web development
and deployment.  If you combine the libraries, it becomes bloated with
functionality you hardly ever use (the main problem with DAO).  Most
web pages only need to perform CRUD operations (Create, Read, Update,
Delete) on table data, but rarely need to create definitions or alter
definitions of SQL objects (tables, indexes, columns, etc.)  It makes
sense to thin the main library down by placing them into 2 physical
libraries.

Kirk Allen Evans



Quote:> I don' have a problem using SQL to create tables with tinyint fields,
I've
> had problems with ADOX in many other places (such as creating date
fields
> when reading a date field from a Jet 351 database, type missmatch.)
I have
> a funny feeling ADOX is not there yet.  It seems to me, and this is
just my
> opinion, that when ADO 2.0 came on the scene everyone complained
there was
> no syntax to manipilate database structure with ADO, so MS quickly put
> together ADOX and shipped it with ADO 2.1.  I always wondered why
ADOX is a
> separate COM than ADO.  Whay was it not part of ADO like DAO?

> Just my option, of course.

> Richard

--
Kirk Allen Evans

(Do not send mail to the Deja News account used

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

1. Create adTinyInt column with ADOX in SQLServer causes error

I am creating a new table in SQLServer 7.0 using ADOX 2.1 from VB6. When i
try to create a column of type adTinyInt, the program causes the following
error in the Catalog.Tables.Append method:
Run-time error '-2147217859 (80040e3d)': a specified type was invalid

It all works fine if i create a column with (for instance) the adInteger
type instead.

Here is the code:

-------
Private Sub Command1_Click()

Dim CnTo As New ADODB.Connection

Dim XCatalog As New ADOX.Catalog
Dim XTable As New ADOX.Table
Dim XColumn As New ADOX.Column

CnTo.Open "Provider=SQLOLEDB;User Id=sa;Initial Catalog=test1"

'Reference to the catalog
Set XCatalog.ActiveConnection = CnTo

'Create New Table
XTable.Name = "NewTable"
'Create New column
XTable.Columns.Append "NewColumn", adTinyInt
'Now Append the table (this gives the error)
XCatalog.Tables.Append XTable

End Sub
--------------------

Helps appreciated.

Fabio Pagano

2. Informix/Oracle C/C++ Employment Opportunities

3. d3 Linux problem

4. Create SQLServer DB from ADOX-VB6

5. Any body no about Plastic ????

6. Creating Stored Procedures on SQLServer 7 with ADOX

7. Printing graphics to slave printers

8. SQLServer ADO - insert into select - causes empty recordsets to be created

9. Creating a job in a trigger causes intermittent Can not CREATE TABLE error

10. Creating columns with ADOX