MySQL select query with parameter

I am trying to use MYSQL select query with c#.

Following query for searching "ID" is working fine:

conn = new MySqlConnection(cs);
conn.Open();
cmd = conn.CreateCommand();
cmd.CommandText = "select * from catalog_product_entity where entity_id = ?Id";
MySqlDataAdapter adp = new MySqlDataAdapter(cmd);
cmd.Parameters.Add("?Id", SqlDbType.Text).Value = ProductList[i].ProductId.ToString();
adp.Fill(MagentoProduct);

Now, I want to search exact string value in table. I am using following code and its giving empty result:

My Code:

                            conn = new MySqlConnection(cs);
                            conn.Open();
                            cmd = new MySqlCommand("select * from catalog_category_entity_varchar where value = @Value;", conn);
                            cmd.Parameters.AddWithValue("@Value", "Storybooks");
                            MySqlDataReader r = cmd.ExecuteReader();

                            while (r.Read())
                            {
                                log.WriteEntry(r.GetString("value"));
                            }
Jon Skeet
people
quotationmark

This is the problem:

where value = '?cname'

That's specifying ?cname as the literal value you're searching for - when you actually just want the parameter. Remove the quotes and it should be fine:

where value = ?cname

(You should use using statements for the connection and command, mind you...)

people

See more on this question at Stackoverflow