o abuzaid

o abuzaid

  • 1.6k
  • 77
  • 3.8k

Select statement with substring function

Apr 30 2021 7:25 PM
i have textbox for my user to type first 3 or 4   or any number of characters to seach for full name of drug  from sql table  named grugs 
i used Lenght function to find no of characters typed  so i can use this number with substring function to display all drug names started with enterd characthers 
 
int i = textBox1.Text.Lenght; 
select * from drugs where Substring(drg_name,0, i ) =  textBox1.Text 
 
but this gives me Error says Invalid Column name i  
 
any Idea smart pepole ?  

Answers (2)