I have two textboxes Textbox1 and Textbox2 and 1 gridview
i want my site users may search record either by entering the city name in textbox1 or by entering the country name on textbox2开发者_开发知识库 via gridview .
There's a whole lot more information we need to help answer this in detail.
In general, you need to take the values in the textboxes, convert them into a SQL query which is sent to the database and bind the resultset which is returned to you gridview.
Depending on what data access mechanism you're using, how to achieve this varies greatly - If you don't know what data access mechanism exist, I'd suggest you start reading up on LINQ-To-SQL as it's pretty easy to use and safe against SQL injection attacks.
If you can provide more details of what you're trying to accomplish, we may be able to help further eg:
- What version of the .Net Framework are you using
- What database software i in use (Microsoft SQL Server, MySQL, Oracle, etc.)
- What does the tabl you want to search look like? (What fields, etc)
精彩评论