hi this is my last thread
http://www.aspforums.net/Threads/104489/Display-all-products-and-products-from-category-using-QueryString-aspnet/
when i write this function
private void BindDataList(SqlConnection _cn, string query, List<KeyValuePair<string, object>> parameters, DataList dl)
{
SqlCommand _cmd = new SqlCommand(query, _cn);
_cmd.CommandType = CommandType.StoredProcedure;
if (parameters != null)
{
for (int i = 0; i < parameters.Count; i++)
{
_cmd.Parameters.AddWithValue(parameters[i].Key, parameters[i].Value);
}
}
_cn.Open();
SqlDataReader _dr = _cmd.ExecuteReader();
if (_dr.HasRows)
{
dl.DataSource = _dr;
dl.DataBind();
}
}
//with Parameters
List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string,object>>();
KeyValuePair<string, object> keyValuePair = new KeyValuePair<string,object>("@h_name", Request.QueryString["h_name"]);
parameters.Add(keyValuePair);
BindDataList(_cn, "select * from products where h_name=@h_name", keyValuePair, DataList1);
//without Parameters
BindDataList(_cn, "select * from products", null, DataList2);
this error occur
Error6The best overloaded method match for 'house_equipment_.BindDataList(System.Data.SqlClient.SqlConnection, string, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string,object>>, System.Web.UI.WebControls.DataList)' has some invalid argumentsD:\behtop project\behtob website\house equipment .aspx.cs239D:\behtop project\behtob website\
Error7Argument 3: cannot convert from 'System.Collections.Generic.KeyValuePair<string,object>' to 'System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string,object>>'D:\behtop project\behtob website\house equipment .aspx.cs2344D:\behtop project\behtob website\
what can i do?