I’m having an issue with outputting results from a list into strings and getting the ‘input string was not in a correct format.
objConn = New SqlConnection(strConnection)
objConn.Open()
objCmd = New SqlCommand(strSQL, objConn)
rsData = objCmd.ExecuteReader(0)
If rsData.HasRows Then
Do While (rsData.Read())
SubjectNames.Add(rsData.GetString("Subject"))
Loop
End If
rsData.Close()
objConn.Close()
Dim first As String = SubjectNames(0)
Dim second As String = SubjectNames(1)
html += "<p>" & first & "</p>"
html += "<p>" & second & "</p>"
Now I’m getting the error on the adding to the list line, the subject field in the SP is an all text field and should return a subject name.
Any ideas on what I’m doing wrong(again!)
Thanks!
Give column index of the row instead of column name .
SubjectNames.Add(rsData.GetString(ColumnIndex)) // 0 or 1 or 2
hope this helps
Since GetString() function will accept only index not column name