Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi how can I search a specific string data in some tables of a database by c#?
is there any one to help me?
Posted
Comments
RaisKazi 20-Aug-11 5:06am    
Do you want to fetch records from a Database Table, matching to your input string using C#?
thatraja 20-Aug-11 14:48pm    
Include the table structures in your question for the quick solution
isooda 21-Aug-11 4:25am    
yes.bot I want to fetch records from some tables of database.not one table

1 solution

 
Share this answer
 
Comments
RaisKazi 20-Aug-11 5:12am    
Should work. 5!. Although question was not very clear.
isooda 30-Aug-11 4:43am    
suppose I have 5 tables in my database.one of them "author" includes authorName & authorID.the rest of tables are diffrent subject of books.for example one of them is about computer engineering and the other one is about electronic ...
I want to get author's name by user and display all the books of him.
so if this author's name is existed in the author table I should search that 4 tables.now I mant to know how can I search that 4 tables?How can I search more than one table?I'm using C#
please help me.
Keith Barrow 30-Aug-11 12:31pm    
That is not a C# question, but a SQL one. If you have more than one table you select as you would and use either a join or where clause to add the results to the "main" table.If you google for SQL Select Join Subquery you'll get thousands of examples.
One final this is that your database design sounds partially wrong: Having a table per-category is bad. It is better to have a single table of category types ("Electronics", "Computer Science" etc) and a table that maps the book to the categories as a book could both be a CS and electronics book. You should also have the same thing for authors because 1 author can have meny books, and one book can have many authors (many to many). You should google for "SQL cross-reference table" / "SQL x-ref table" or "SQL many to many relationship"

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