Quantcast
Channel: VBForums - Database Development
Viewing all articles
Browse latest Browse all 2918

[RESOLVED] Get the value of DefaultValue property from schema for a field in an SQLite table?

$
0
0
I am using SQLite (System.Data.SQLite for .NET v1.0.116.0) for an application and having trouble getting the DefaultValue property values for fields from the table schema of the SQLite database.

Here is the database structure of the Plants table from the "DB Browser for SQLite" program:

Name:  2022-07-11_6-20-49.jpg
Views: 43
Size:  28.6 KB

The DEFAULT property values of the "Active", "PlantType", "Sunshine", and "Water" fields are configured.

When I query the database schema for the Plant table using the following code, the DefaultValue property values for these 4 fields are not shown.

Code:

Dim strSQL As String = "Select * FROM [" & cboTables.Text & "]"
Using cmd As New SQLite.SQLiteCommand(strSQL, con)
    Using rdr As SQLite.SQLiteDataReader = cmd.ExecuteReader(CommandBehavior.KeyInfo)
        tbl = rdr.GetSchemaTable
    End Using
End Using

For Each row As DataRow In tbl.Rows
    Debug.WriteLine("{0}, {1}", row("ColumnName"), row("DefaultValue"))
Next row

The Immediate Window shows the following:

HTML Code:

RecID,
AddDate,
ModDate,
Active,
CommonName,
BotanicalName,
PlantType,
Sunshine,
Water,
Note,

Why are the DefaultValue properties that are configured in the SQLite database not returned by the query?
Attached Images
 

Viewing all articles
Browse latest Browse all 2918

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>