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.
I’d therefore be more than grateful if someone could very kindly help me out immediately.
cmd = New SqlCommand( _
"select subjectCode from ProgramDetails.subjects where subjectname='" & _
Trim(subname) & " ' ", cn)
dr = cmd.ExecuteReader
If dr.Read Then
subcode = dr(0)
End If
dr.Close()
SQL-ParametersLIKEwith the wildcard%instead:For example: