c# Using Parameters.AddWithValue in SqlDataAdapter
The string used to initialize the SqlDataAdapter becomes the value for the CommandText property inside the SelectCommand property of the SqlDataAdapter. You could add parameters to that command with this code da = new SqlDataAdapter(“SELECT * FROM annotations WHERE annotation LIKE @search”, _mssqlCon.connection); da.SelectCommand.Parameters.AddWithValue(“@search”,”%” + txtSearch.Text + “%”); First, remove the single quotes around the … Read more