Ok. the following code is something i use a fair amount. There would be something in a table with information in it like the following:
45,43,56,77,22,33</p> This would repesent, lets say as an example, an order for a user. so the user would have bought them products in a single purchase. To get the information about the products, i send that string into a function that splits it and returns a SQL statement. Now, the following code includes a button for testing it. If you see any better ways of doing this, please post a reply!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Private Function test(ByVal list As String) As String
Dim sql As String
sql = "select * from products where productid = "
Dim seperator As String = ""
Dim x As Array
Dim i As Integer
x = Split(list, ";")
For i = 0 To x.Length – 1
If x(i) <> "" Then
sql += seperator & x(i)
seperator = " or productid = "
Hope this helps!