Click here to Skip to main content
16,018,353 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi master c#..
i want ask about how to search data from database on c# language??
ex: i have form 1 with dataGridView with 1 textbox,1 combobox,& 1 button
the textbox for create a character
combobox for criteria
button 1 for process
how to search data from database with criteria & character input,then show on datagridview?
give me solution
:)
Posted

Hi,

You need to learn about SQL query, ADO.NET, and C#.

Do not start with solution oriented learning, start reading some books , articles and try to create small examples from articles.

Download opensource code and analyze the code. It's not about one day journey, you need to learn language and then you are ready to answer your question.

Helpful material:

C# Nutshell ebook[^]

MSDN ADO.NET[^]

MSDN Windows Forms[^]

And any book from APress publication(good for beginner)

hope this information helps you,

Thanks.
 
Share this answer
 
Searching the database - you will use a simple query with a WHERE clause.

For e.g. Select * from myTable where name = 'abc'

You can easily do searches using IN and LIKE operators[^] in SQL.
 
Share this answer
 
v2
Comments
Sandeep Mewara 5-Jul-12 1:34am    
Comment from OP:

i try this but error
"select *from t_Data_Barang where ID LIKE=%'"+textBox1.Text +"'%";
Abhinav S 5-Jul-12 1:42am    
What error?

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