title: ASP.NET VB - Conversion from type 'DBNull' to type 'String' is not valid
body: <p>I have the following ASP.NET (VB) code:</p>
  
  <pre><code>    strLocation = CStr(q1("LocationName")) + " " + CStr(q1("LocationAddress")) + " " + CStr(q1("LocationCity"))
  </code></pre>
  
  <p>As LocationCity is null:</p>
  
  <p>I get Conversion from type 'DBNull' to type 'String' is not valid.</p>
  
  <p>Is there a way to fix this.</p>
  
  <p>If it was only LocationCity I would probably do something like:</p>
  
  <pre><code>    If IsDBNull(q1("LocationCity")) Then
          strLocation = ""
      Else
          strLocation = CStr(q1("LocationCity"))
      End If
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>    strLocation = If(CStr(q1("LocationName")), "") + " " + If(CStr(q1("LocationAddress")), "") + " " + If(CStr(q1("LocationCity")), "")
  </code></pre>
  
  <p>but got the same result</p>
  
  <p>In C# I would normally use ?? but not sure of the best approach in ASP.NET VB</p>