How to specify DEFAULT value for parameter in prepared query?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
AlexanderPriem
Posts: 29
Joined: Fri 24 Feb 2006 09:54

How to specify DEFAULT value for parameter in prepared query?

Post by AlexanderPriem » Tue 14 Nov 2006 13:46

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.

AlexanderPriem
Posts: 29
Joined: Fri 24 Feb 2006 09:54

Urgent: Do you have an answer for me yet ?

Post by AlexanderPriem » Wed 15 Nov 2006 19:46

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...

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 16 Nov 2006 11:34

We do not have off-hand solution for inserting default column values in prepared statements. Try to do it by means of SQL.

Post Reply