Subject: How do you set a column to NULL in a parameter?
Posted By: Aaron Edwards Post Date: 4/7/2006 5:43:19 PM
I need to be able to set a int column in SQL2005 to null once in a while, within a parameter construct, i.e.

cmd.Parameters.Add(New SqlParameter("@fkSecondLevelPageID", 'null'))

I've tried 'null', vbNull and "", but none of them do the job.

Thanks!

Aaron

Reply By: Imar Reply Date: 4/7/2006 6:15:56 PM
Hi Aaron,

You need to use DBNull.Value instead of null.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Reply By: Aaron Edwards Reply Date: 4/7/2006 6:20:12 PM
Thanks again, Imar.



Reply By: Imar Reply Date: 4/7/2006 6:26:22 PM
You're welcome once again... ;-)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004

Go to topic 42617

Return to index page 320
Return to index page 319
Return to index page 318
Return to index page 317
Return to index page 316
Return to index page 315
Return to index page 314
Return to index page 313
Return to index page 312
Return to index page 311