Hi,
Olaf said:
I'm looking for a way of retrieving the default-value of a table's field
within an Access 2003 MDB.
Any hints on how to accomplish this from ASP.Net?
got it (although not all too satisfying - see below).
Here's some code that'll display all columns within a given table along
with their default-values:
--- 8< ---
Dim cn As New OleDbConnection
cn.ConnectionString = "Whatever ..."
cn.Open()
Dim tbl As DataTable
tbl = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, _
New Object() {Nothing, Nothing, "Name of Table", Nothing})
For Each r As DataRow In tbl.Rows
Response.Write _
r("COLUMN_NAME") & ": " & _
r("COLUMN_DEFAULT") & "<br />"
Next
--- 8< ---
If anybody has a more appropriate way of retrieving this by a column's name
(rather than looping through all columns), let me know!
Cheers,
Olaf