I'm in the process of making an ASP.net web application which will allow users to paste values into a multi-line text box and press a submit button. On button click, this will run a database query based on the product codes they've input into the textbox.
I've managed to get this working for one code in the text box. However, What I'm struggling to do is allow for multiple product codes in the text box. How do I split the values in the text box, to be comma separated and use in my ACCESS SQL query?
The code below is what I used for a single line in a text box, which works fine.
string selectString = "SELECT Patt1, Description, Oversize FROM Item WHERE Patt1 = '" + TextBox1.Text + "'";
Essentially, what I'd like to do is use the same kind of query but like below:
string selectString = "SELECT Patt1, Description, Oversize FROM Item WHERE Patt1 sInStatement";
Where sInStatement would be "IN (1234, 1235, 1236, 1237) **The codes here would be found in TextBox1 which I'd need to separate out with a comma, etc.
Can this be done?