title: How to remove white space in VB.Net
body: <p>In the following code SqlDataReader 'dr' does not read the "SubjectCode" of subjects whose names contain white space; example English Language, Social Studies, Principles of Cost Accounting, etc. from the subjects table. </p>
  
  <p>I'd therefore be more than grateful if someone could very kindly help me out immediately.</p>
  
  <pre class="lang-vb prettyprint-override"><code>cmd = New SqlCommand( _
      "select subjectCode from ProgramDetails.subjects where subjectname='" &amp; _
      Trim(subname) &amp; " ' ", cn)
  dr = cmd.ExecuteReader
  If dr.Read Then
      subcode = dr(0)
  End If
  dr.Close()
  </code></pre>