Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
i need help in sql server and c# i want when type number in the textbox appear to me value inside the quantity column less than that number like if i write 5 appear to me all column that quantity less than 5 i didn,t write any code fr that but i need help fast use sql server 2008 r2
Posted
Comments
Suvendu Shekhar Giri 26-Jun-15 23:49pm    
SELECT * FROM MyTable WHERE Coumn1 < 5
ÃHmed Élkady 27-Jun-15 0:09am    
you didn,t understand me i need if i write 5 in textbox search in the database for the column that had quantity less than 5
Suvendu Shekhar Giri 27-Jun-15 0:22am    
SELECT * FROM MyTable WHERE Coumn1 < @Value1
cmd.Parameters.AddWithValue("@Value1", int.Parse(yourTextboxId.Text));


It would be easier for us to find an appropriate solution if you can provide the table structure and the expected result output(sample).
ÃHmed Élkady 27-Jun-15 0:37am    
i had table called class and a column quantity it detremine the quantity of item i need if i write 5 or 1 or whatever in the textbox so show me the items less than the value i write it in the textbox
Suvendu Shekhar Giri 27-Jun-15 1:02am    
If you know parameterized query then try this-
SELECT * FROM Class WHERE Quantity < @Quantity
cmd.Parameters.AddWithValue("@Quantity", int.Parse(txtQuantity.Text));


Else try this-
string query="SELECT * FROM Class WHERE Quantity < "+txtQuantity.Text;

N.B. Inline queries should be avoided to prevent SQLInjection

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