Page 1 of 1

How to specify DEFAULT value for parameter in prepared query?

Posted: Tue 14 Nov 2006 13:46
by AlexanderPriem
Hello,

I have a table in which some fields have default values. I have a prepared query that inserts into this table, something like this :

Insert Into tablename (field0,field1,field2,field3,field4,field5)
values (@0,@1,@2,@3,@4,@5);

Now I want to specify that for a certain field (say @0) I want to insert the DEFAULT value for that field in the DB.

How can I specify this?
Using objCommand.Parameters.Item['@0'].set_Value() ?

I use set_Value to specify the value for my other parameters, but how can I tell it to use the DEFAULT?

Please dont tell me to make a special prepared query for cases when i want to use default values, since there are more than one columns that use defaults and I really dont want to make special queries for all possible combinations :(

I hope you can help me with this.

Urgent: Do you have an answer for me yet ?

Posted: Wed 15 Nov 2006 19:46
by AlexanderPriem
Dit you have time to look into my issue yet? I am waiting for a solution to this problem and it's quite urgent for me.

I hope you can help me out soon...

Posted: Thu 16 Nov 2006 11:34
by Alexey
We do not have off-hand solution for inserting default column values in prepared statements. Try to do it by means of SQL.