Nepethya Rana

Nepethya Rana

  • NA
  • 335
  • 152k

I do not know why do not get data back - Ado.net

Jun 30 2017 3:03 PM
My sqlQuery = string sql = "SELECT StoreType from location where locationId in (@pRowValue) order by region, district, locationId";
This is my code:
string storeNum = "";
foreach (DataRow row in dt.Rows)
{
storeNum += row["store"] + ",";
//storeNum += string.Format(@"'{0}',", row["store"]);
}
storeNum = storeNum.Remove(storeNum.LastIndexOf(','));
SqlDataAdapter da = new SqlDataAdapter(sql, con);
da.SelectCommand.Parameters.AddWithValue("@pRowValue", storeNum);
da.Fill(dtStoreType);
but I do not get any records back?

Answers (3)