Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Combo in Grid - WHERE LIKE

$
0
0

Settled. The following works for me: LIKE CONCAT('%', @AccountCode, '%')

protectedvoidrcbAccountCode_ItemsRequested(objectsender, RadComboBoxItemsRequestedEventArgs e)
{
    stringMysql = "SELECT * FROM rfaccount WHERE AccountCode LIKE CONCAT('%', @AccountCode, '%')";
    MySqlDataAdapter adapter = newMySqlDataAdapter(Mysql,
        ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
    adapter.SelectCommand.Parameters.AddWithValue("@AccountCode", e.Text);
  
    DataTable dt = newDataTable();
    adapter.Fill(dt);
  
    RadComboBox comboBox = (RadComboBox)sender;
    // Clear the default Item that has been re-created from ViewState at this point.
    comboBox.Items.Clear();
  
    foreach(DataRow row indt.Rows)
    {
        RadComboBoxItem item = newRadComboBoxItem();
        item.Text = row["AccountCode"].ToString();
        item.Value = row["AccountId"].ToString();
        item.Attributes.Add("AccountName", row["AccountName"].ToString());
  
        comboBox.Items.Add(item);
  
        item.DataBind();
    }
}

Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>