The value has to be NULL for the default value to fire.

If it's an empty string, "", that's what you'll get.



StanD.

----- Original Message ----- Subject: [sqlite] Grabbing "default values" from the database...


I'm working on a project in C# that uses an SQLite database back-end.

I have a table set up so that some columns have default values, such as:

CREATE TABLE mc_question (id integer primary key autoincrement, q_type
varchar(5) default "MC", single_multi bool, negative_score
bool, cumulative_all bool, title_text varchar(200), question_format
bool, question varchar(200), image_file varchar(200), ans_order
bool, indices bool, ans_layout bool, feedback varchar(200), category_id
integer);

The "q_type" column is of type varchar(5) and has a default value of "MC".

I'm using DataGridView Controls which are bound to different BindingSource
objects, and I would like to populate the DataGridView columns with the
default values that are set within the database itself, so that I don't have
to set each column manually...

Does anyone know how I would do this? If not, could someone tell me how to
grab the "default values" from the database? (I thought that FillSchema
would do it, but it doesn't)

Sincerely,

Gordon E.

P.S. I have asked in a MS ADO .NET forum, but they're no help.  They just
keep telling me I should set all the columns' default values manually... but
that's such a pain in the <you-know-what>.


Reply via email to