Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,
I am confused about searching a data from database using SQL server. if any one have answer of this question in C# language please help me
Posted
Updated 7-Apr-11 23:40pm
v2
Comments
jim lahey 8-Apr-11 5:43am    
the trouble is, I don't see the question..
Sandeep Mewara 8-Apr-11 6:43am    
What trouble?

Use a SELECT statement with a WHERE clause:
using (SqlCommand com = new SqlCommand("SELECT * FROM Customers WHERE CustomerId=102", con))
   {
   SqlDataReader r = com.ExecuteReader();
   while (r.Read())
       {
       Console.WriteLine("{0}:{1}:{2}", r["Customer"], r["date"], r["Value"]);
       }
   }
 
Share this answer
 
1. Google ADO.Net C#.
2. You will get 5,660,000 hits.
3. Read any of above.

See, programming is easy!
 
Share this answer
 
you have mentioned that you are confused about searching data from database but you haven't mention whats lead you to confusion. have you tried some thing if so please so your code then we will easily justify with question.
whatever, come to your question "searching Data" means retrieving Specific Attributes based on the condition like
* Record that Match one or more conditions
* Records that Contain values in a given range
* Records that contain any value from a given set of values
* Records that match a pattern
* Records that Contain Null values
* Records to be displayed in a sequence
* Records from the top of a table
* Records without duplications of values
Now which condition matching your requirement
Take a look there-[Retrieving Data Using a C# ][^] where you can learn how to search data.
 
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