ADO.Net - Field size and precision

C

Claude

How can I get the complet schema of a datacolumn using ADO.Net objects (the
equivalent of ADOX in ADO 2.8) ?

I need to know the DataType, the DataSize, the Precision...

The DataColumn object only gives DataType.

Thanks,
Claude
 
M

Misbah Arefin

there is no equivalent of ADOX in ADO.NET

you can get the schema of a database by using the GetOleDbSchemaTable method
of the Connection object

note that no method is equivalent to GetOleDbSchemaTable when you use a
SqlClient.SqlConnection object. The SQL Server .NET Data Provider exposes
backend schema information through stored procedures and informational views

if you happen to be using SQL Server, you can use the Information_Schema
views to retrieve info about database objects
 
A

Arne Vajhøj

Claude said:
How can I get the complet schema of a datacolumn using ADO.Net objects (the
equivalent of ADOX in ADO 2.8) ?

I need to know the DataType, the DataSize, the Precision...

The DataColumn object only gives DataType.

Try:

SELECT COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,NUMERIC_PRECISION
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='foobar'

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top