I am trying to take the vales (comma separated) from a text box and pass them to a query string in an ExecuteSQL statement. I am not sure how to do this correctly. The obvious issue is that it will break if there are more or less than the three exceptions. I need to use an array or list, but don't know how to read that back into the query string?
This is what I have so far:
Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
Dim db As New Database
If txtEmpExceptions.Text.ToString() IsNot Nothing Then
Dim EmpExcept1 As String = txtEmpExceptions.Text.ToString().Split(",")(0)
Dim EmpExcept2 As String = txtEmpExceptions.Text.ToString().Split(",")(1)
Dim EmpExcept3 As String = txtEmpExceptions.Text.ToString().Split(",")(2)
db.ExecuteSQL("Delete dbo.Employee where employeeID <> '" & EmpExcept1 & "' and employeeID <> '" & EmpExcept2 & "' and employeeID <> " & EmpExcept3, prodString)
Else
db.ExecuteSQL("Delete dbo.Employee", prodString)
End If
End Sub