Click here to Skip to main content
15,868,419 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Error is
Name IIf and DBNull are not declared

Code is
cmd.Parameters.Add("@address2", SqlDbType.VarChar).Value = IIf(Address2.Trim.Length > 0, Address2, DBNull.Value)
Posted
Updated 14-Nov-11 1:37am
v2
Comments
Manfred Rudolf Bihy 14-Nov-11 9:59am    
Please don't completely change your question. Now the solutions no longer fit the question. If you have a new question with new context please open up a separate post for that. Please change the question back to its original state and post a new question with the current content.

Thanks for your cooperation!

You'll have to add a reference to System.Configuration as well as using the Imports keyword.

Cheers!

—MRB
 
Share this answer
 
v3
Comments
thatraja 14-Nov-11 7:34am    
Both answers(Solution 1 & 2) posted at the same sec(27 secs)
5!
Manfred Rudolf Bihy 14-Nov-11 7:46am    
Thank you, man!
add the line
VB
Imports System.Configuration
 
Share this answer
 
Comments
thatraja 14-Nov-11 7:34am    
Both answers(Solution 1 & 2) posted at the same sec(27 secs)
5!
Pandya Anil 14-Nov-11 7:44am    
tnx, nice observation :)
Sergey Alexandrovich Kryukov 14-Nov-11 14:31pm    
Same thing as you other answer, but this time it's correct as it does not mentioned adding a reference, which is completely different thing. So, this time I voted 5.
--SA
Please see my recent solution how to solve defined error[^].

And please avoid re-posting questions. Even though it's not re-post, you would not need one question if you know the answers to another one.

—SA
 
Share this answer
 
i tried it, but i don't know why it is not working in my project.
i am using vs 2010 and today i have install vs 2012.
after installing vs 2012 i am facing this type of problem.
:(
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900