Click here to Skip to main content
15,891,933 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I am trying to carry out a query using multi-line textbox feature and I am little stuck into getting the code to work. I have updated my code and I am experiencing an sql error
Incorrect syntax near 'OR'.

on the following line below:
C#
da.Fill(ds);



Any help would be very much appreciated.
Thanks.
Posted
Updated 16-Apr-15 5:05am
v3
Comments
ZurdoDev 16-Jan-14 9:58am    
Please step through your code and narrow down where the issue is.
miss786 17-Jan-14 5:42am    
Hi ryan, apology for the late reply,I manage to update my code and I narrow down the problem to sql error. If you get time, could you suggest any solution, if possible. Many thanks.

1 solution

this is doing nothing. search is set to empty and never set to a value

C#
string search = String.Empty;
         string[] names = search.Split(',').Select(n => string.Format("'{0}'", n.Trim())).ToArray();
         foreach (string v in VarinateNo)
         {

             search = search.Replace("\r", string.Empty);
         }

         search = search.Trim(',');


I suspect that instead of

search = search.Replace("\r", string.Empty);


you want

search += v.Replace("\r", string.Empty);
 
Share this answer
 
Comments
miss786 17-Jan-14 5:36am    
Hello, Thank you so much for your help. I manage to re-write textbox method and have updated little bit.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900