1

For Search textbox

this is my query correct query

Select tip_part_no as TIPPartNo, date_rec as DateRecieve, reciever_name as RecieverName,
qty, SUM(qty) as Total from pcba_info.lot_info where tip_part_no like '' group by 
packing_list_no;

error in my program vb,net T_T

("Select tip_part_no as TIP, SUM(qty) as Total_Quantity from pcba_info.lot_info 
WHERE tip_part_no LIKE '%" & Trim(txtsearch.Text.TrimEnd()) & "%' group by 
tip_part_no '%" , con)
1
  • 1
    What is your question? Commented Jan 29, 2014 at 8:55

2 Answers 2

2

You should use a parameterised query for this...

Your query then looks like this:

Select tip_part_no as TIPPartNo, date_rec as DateRecieve, 
reciever_name as RecieverName, qty, SUM(qty) as Total from pcba_info.lot_info 
where tip_part_no like @tip_part_no group by packing_list_no;

Then you add the parameter @tip_part_no with the value txtsearch.Text.Trim()

Information about using LIKE operator in parameterized queries: Parameterized Queries with LIKE and IN conditions

Example and background information here: How do I create a parameterized SQL query? Why Should I?

Sign up to request clarification or add additional context in comments.

Comments

0

Remove %,' (Percentage and Single quotes) symbols near Group By (group by tip_part_no '%")

Try like this

"Select tip_part_no as TIP, SUM(qty) as Total_Quantity from pcba_info.lot_info 
WHERE tip_part_no LIKE '%" & Trim(txtsearch.Text.TrimEnd()) & "%' group by 
tip_part_no" , con

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.