I am using a checkbox list to selected orders for export and I am using the following to export the orders My Question is how do i place the chracher , within the in statement using the below code ?
For Each obj As Object In CheckedListBox1.CheckedItems
tempstring = Chr(39) & obj.ToString() & Chr(39)
sb.AppendLine(String.Join(",", tempstring)
Next
Function to return sql
Friend Function GetDistinctOrdersForLocations(OrderNumber As String) As String Implements
iScriptBuilder.GetDistinctOrdersForLocations
Dim retVal As String = "SELECT DISTINCT location, ordernumber FROM orders "
retVal &= "where orders.ordernumber in (" & OrderNumber & ")"
Return retVal
End Function
This is producing this sql through the above function
SELECT DISTINCT location, ordernumber FROM orders where orders.ordernumber
in ('Puals Test V1'
'Puals Test V2'
)