Click here to Skip to main content
15,914,452 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am making an application C# Winforms for a business firm. and want to search the saved customer name from the sql database and display all the results if the entered name exist more than 1 number.
Posted
Comments
thatraja 22-Feb-11 11:25am    
Actually you got answers here man but please make your question clearly always which will help you to get the perfect answer/solution. cheers

If I've understood you correctly, try something like:

select [col1], [col2], ... from [table] where [customer_id] in (1,2,3,4,5)


or

select [col1], [col2], ... from [table] where [customer_name] in ('name1','name2')
 
Share this answer
 
v3
Look, your question is not clear. The way I understood your question

Given a customer name get all the records that match for that name? Is that right? if so

Select * from table where name = 'name'


gives you all the records. If you want close matches then

select * from table where name like 'name' 


gives you all the records that closely match your name.

Once you get the query result, you need to traverse through all the values to show them in your UI.

There are plenty of tutorial here at CP, look for example this one Using ADO.NET for beginners[^]
 
Share this answer
 
v2
Comments
fjdiewornncalwe 22-Feb-11 9:27am    
My 5 because I think this is what the OP is asking and because you have explained yourself in a very clear and concise manner.
Yusuf 22-Feb-11 9:38am    
Thanks
Would something like this do:
SQL
SELECT * FROM MyTable WHERE MyTable.CustomerName LIKE 'searched_Client_Name' HAVING COUNT(*) > 1
 
Share this answer
 
v2
@ Above all
Thanx for your reply..
i am Ok with the sql qry ..but my question is how can i display the results in winform if i got more than one search result...?
 
Share this answer
 

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