---
title: "Search using textbox value and wildcard character"  
description: "Search using textbox value and wildcard character"  
author: "Anonymous User"  
published: 2014-08-29  
updated: 2014-09-01  
canonical: https://www.mindstick.com/forum/2201/search-using-textbox-value-and-wildcard-character  
category: "c#"  
tags: ["c#", "Search using textbox value", "Search wildcard character", ".net", "open source"]  
reading_time: 1 minute  

---

# Search using textbox value and wildcard character

I want to [search](https://www.mindstick.com/articles/65368/best-smo-services-company-in-hyderabad-improve-search-rankings) the empid of a [name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide) that with the [characters](https://answers.mindstick.com/qa/42112/who-is-the-originator-of-avengers-characters) entered in my textbox. using [wildcard](https://www.mindstick.com/interview/33955/why-is-the-sql-wildcard-like-operator-in-the-query) characters. I wrote the statement

da = new [SqlDataAdapter](https://www.mindstick.com/interview/33991/what-is-sqldataadapter)(

"[Select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) empID from emp where [FirstName](https://www.mindstick.com/interview/33973/how-to-split-the-full-name-into-firstname-and-lastname-in-sql-server) like ' "+textbox1.text+" ' % "

, connstring);

da.Fill(ds);

Is this [statement correct](https://answers.mindstick.com/qa/94239/a-high-court-has-no-advisory-jurisdiction-is-the-statement-correct)?

## Replies

### Reply by Sumit Kesarwani

```
string sql = "SELECT empID " +            
"FROM emp " +              
"WHERE FirstName like @FirstName";using(var con = new SqlConnection(connstring))using (SqlCommand command = new SqlCommand(sql, con)){   
command.Parameters.AddWithValue("@FirstName",  textbox1.text + "%");    using(var da = new SqlDataAdapter(command))    {        da.Fill(ds);    }}
```


---

Original Source: https://www.mindstick.com/forum/2201/search-using-textbox-value-and-wildcard-character

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
