Click here to Skip to main content
11,714,776 members (76,918 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#3.0
How to write the coding for search option.

Posted 24-Sep-12 22:55pm
Zoltán Zörgő at 25-Sep-12 4:59am
It depends.
This is not a well formulated question at all. Nobody will be able to help you, since we have no means to know:
- in what you want to search
- how you want to search
- what you want to search
- what is your platform
- what you want to do with your results
- ...
and several other thigs.
So, please elaborate your question.
Kuthuparakkal at 25-Sep-12 4:59am
explain more, not clear
Zoltán Zörgő at 25-Sep-12 5:26am
What is "search the file in the database" meaning exactly?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

"You should perform a search."

That is both:
  • Have you searched for, yet (I suppose you may find many examples, just Google for)?
  • On button click your program should search for whatever is set in (possibly) another control, inside for instance, a file, or a string (you didn't provide enough details).
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

control:- 1 textbox, 1 button, 1 datagridview

write code searchbtn_click event

sqlconnection con=new sqlconnection("Data Source=,; Initial Catalog=database name;uid=sa; pwd=password");;
da = new sqlDataAdapter("select LSTinIPaddress , LSTOutIPaddress from tablename where computername='" + textbox1.text + "'", con);
                        ds = new DataSet();
                        dataGridView1.DataSource = ds.Tables[0].DefaultView;

This is only a sample...plz impliment this code for search file from database...

i think is this possible...

Smile | :)
shambhoo kumar at 25-Sep-12 5:16am
if this code is helpfull to u then accept my answer...
Zoltán Zörgő at 25-Sep-12 5:25am
Ask normally to get answers you want!
Zoltán Zörgő at 25-Sep-12 9:03am
No one is giving the proper answer, because you do not ask properly :(
Zoltán Zörgő at 25-Sep-12 9:12am
I don't - even if it is my free choice to do so. Believe me, I would help you, but I still can't see what you want - in technical, programming terms. Please, be aware, that I can not read your mind.
Zoltán Zörgő at 25-Sep-12 9:39am
So, you have a table in an sql server database on a server. That table contains at least three fields (ComputerName,LSTinIPaddress,LSTOutIPaddress). You have a WindwsForms application that has a form with a field, where you enter a computer name, and you want the two associated IPAddress fields as return. Is this correct? You have a working connection string to the database?
shambhoo kumar at 27-Sep-12 2:08am
hello frnd use my code for this purpose........
i think my code is fullfill ur requirement.....
aditiyayuswan at 19-Jan-13 12:46pm
thanks for you coding this is very helpfully
Shambhoo kumar at 19-Jan-13 12:55pm
if this code is helpfull to u then accept my answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 530
1 Richard MacCutchan 275
2 Maciej Los 259
3 ManasKumarM 155
4 Frankie-C 115
0 Sergey Alexandrovich Kryukov 775
1 CHill60 415
2 Richard MacCutchan 405
3 Maciej Los 389
4 OriginalGriff 320

Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100