Reading the access Db remarks & Field type .

S

Sharon

Hi all

Is it possible to read the remarks for fields in Access database?
I want to display them as tool tip

Explanation:

Upon editing table in access (design view) u insert the table characaristics
in a table of 3 columns:
Field Name - the column name
Data Type its data type
Description - the description of the columns

I'm trying to get to the description column
Also, I need to know if the filed is required / and its length in order to
validate the user input

Thank you very much
Sharon
 
P

Paul Clement

¤
¤ Hi all
¤
¤ Is it possible to read the remarks for fields in Access database?
¤ I want to display them as tool tip
¤
¤ Explanation:
¤
¤ Upon editing table in access (design view) u insert the table characaristics
¤ in a table of 3 columns:
¤ Field Name - the column name
¤ Data Type its data type
¤ Description - the description of the columns
¤
¤ I'm trying to get to the description column
¤ Also, I need to know if the filed is required / and its length in order to
¤ validate the user input
¤

Yes, you can use GetOleDbSchemaTable:

Dim DatabaseConnection As New System.Data.OleDb.OleDbConnection
Dim SchemaTable As DataTable

DatabaseConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=E:\My Documents\db1.mdb"

DatabaseConnection.Open()

SchemaTable =
DatabaseConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Columns, _
New Object() {Nothing, Nothing, "Table1"})

Dim RowCount As Int32
For RowCount = 0 To SchemaTable.Rows.Count - 1
'Console.WriteLine(SchemaTable.Rows(RowCount)!PK_NAME.ToString)
'Console.WriteLine(SchemaTable.Rows(RowCount)!COLUMN_NAME.ToString)
'Console.WriteLine(SchemaTable.Rows(RowCount)!CATALOG_NAME.ToString)
'Console.WriteLine(SchemaTable.Rows(RowCount)!DESCRIPTION.ToString)
'Console.WriteLine(SchemaTable.Rows(RowCount)!CATALOG_NAME.ToString)
'Console.WriteLine(SchemaTable.Rows(RowCount)!DESCRIPTION.ToString)
'Console.WriteLine(SchemaTable.Rows(RowCount)!IS_NULLABLE.ToString)
'Console.WriteLine(SchemaTable.Rows(RowCount)!TABLE_NAME.ToString)
Next RowCount

'Shows what information is available
DataGrid1.DataSource = SchemaTable

DatabaseConnection.Close()


Paul
~~~~
Microsoft MVP (Visual Basic)
 

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