Hi, I keep getting the following error: "Input String was not in correct format" and it relates to the following line of code:
I cannot grasp why this error keeps occuring. I have definately used this format (i.e. datarow = dataset.tables("tablename").rows.find(something)) elsewhere and have had no problems.
What I'm doing is reading the values in a listbox and trying to find their related IDs. The values in the list box are names from one particular table in a database and I need to get their IDs to save to a second table.
Here is my code:
The loop works fine, I've ran it on its own, minus the 2lines of code towards the end. It reads the data from the listbox(about 20 names)
Any suggestions as to what may be causing this error??Thanks
VB.NET:
objRow1 = objDataSet.Tables("tblStudent").Rows.Find(selA)
I cannot grasp why this error keeps occuring. I have definately used this format (i.e. datarow = dataset.tables("tablename").rows.find(something)) elsewhere and have had no problems.
What I'm doing is reading the values in a listbox and trying to find their related IDs. The values in the list box are names from one particular table in a database and I need to get their IDs to save to a second table.
Here is my code:
VB.NET:
objCurrentRow1 = objDataSet.Tables("tblAttendance").NewRow
Dim selA As String
For iLoop = 0 To lstStudents.Items.Count - 1
If lstStudents.Items(iLoop) IsNot Nothing Then
selA = lstStudents.Items(iLoop)
objRow1 = objDataSet.Tables("tblStudent").Rows.Find(selA.ToString)
objCurrentRow1.Item("StudentID") = selA
End If
Next iLoop
Any suggestions as to what may be causing this error??Thanks