Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
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 14-Nov-11 2:30am
Edited 14-Nov-11 2:37am
v2
Comments
Manfred R. Bihy at 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!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

Cheers!

—MRB
  Permalink  
v3
Comments
thatraja at 14-Nov-11 7:34am
   
Both answers(Solution 1 & 2) posted at the same sec(27 secs)
5!
Manfred R. Bihy at 14-Nov-11 7:46am
   
Thank you, man!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

add the line
Imports System.Configuration
  Permalink  
Comments
thatraja at 14-Nov-11 7:34am
   
Both answers(Solution 1 & 2) posted at the same sec(27 secs)
5!
Pandya Anil at 14-Nov-11 7:44am
   
tnx, nice observation :)
SAKryukov at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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.
:(
  Permalink  

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

  Print Answers RSS
0 Sascha Lefévre 485
1 Sergey Alexandrovich Kryukov 325
2 Maciej Los 255
3 Abhinav S 185
4 Peter Leow 110
0 Sergey Alexandrovich Kryukov 6,953
1 OriginalGriff 6,311
2 Maciej Los 2,732
3 Peter Leow 2,694
4 Abhinav S 2,652


Advertise | Privacy | Mobile
Web01 | 2.8.150414.1 | Last Updated 17 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100