If you are going to use linq to find the drugs that start with a certain set of characters, then you do not NEED to have a string array hold the names in the first place. Just pull them right from the datatable. If you need help with that, I suggest reading
LINQ Introduction Part 1 Of 3[
^].
In regards to the code you tried...if you are going to iterate through a datatable, there is an easier way than the For Loop that you have setup...you can use a
For Each Statement[
^]. It's just a lot nicer because you don't have to mess with figuring out how many rows there are and stuff like that.
And the reason that your code isn't working has to do with scope. You are declaring variables inside your For statement. Any variable that is declare in the For loop will be thrown away and not accessible when it hits the Next statment and goes to the next row. If you want to keep data that you've gotten from inside a loop, you need to declare the variable that is going to contain it outside the loop.
I'm also not sure what you were doing with the GridView...I thought you wanted a string array? Perhaps you should explain more if what I've said isn't really what you are trying to accomplish.
I hope this helps.