Hi, I have an asp.net web site with the Microsoft Access database. I have a product table, which contain the multiple categories with the coma seprated from the category table. I need to fetch the product information with all the respective category. I have created the product.xsd with the product adapter. I have used the GetCategory(string categoryIds) function, where I pass multiple categories. The problem is that, when I pass single category in the function its return the category information, however when I pass multiple categories then it does not return any record.
Here is the code
private string GetCategories(string categories)
{
categories = "'" + "C0004" + "','" + "C0005" + "'";
string categoryNames = string.Empty;
CategoryMasterTableAdapter obCategoryMasterTableAdapter = newCategoryMasterTableAdapter();
CategoryMasterDataTable categoryTable = newCategoryMasterDataTable();
categoryTable = obCategoryMasterTableAdapter.GetCategories(categories);
for (int iCount = 0; iCount < categoryTable.Rows.Count; iCount++)
{
CategoryMasterRow drow = categoryTable[iCount];
if (!String.IsNullOrEmpty(categoryNames))
{
categoryNames = "," + drow.CatDesc ;
}
else
{
categoryNames = drow.CatDesc;
}
}
return categoryNames;
}
Table Adapter query is
SELECT BookGroup, CatCode, CatDesc, CatTitle, ChildCatCode, ParentCatCode, UpdateStatus FROM CategoryMaster WHERE (CatCode IN (?))
can anyone tell me what is the problem or how to pass the multiple categoryids in a single parameter
[Modified: changed inline code tag to pre tag]