如何读取数据库同一列里符合要求的多行数据
举例:public string getAccessories(string productName, int pnPass1, int pnPass2)
{
string accessories = "";
SQLiteConnection conn = new SQLiteConnection("Data Source=database/HexSettings.db;");
conn.Open();
SQLiteCommand cmd = new SQLiteCommand(conn);
if (productName.Contains("A"))
{
= "select CC from List1 where ProductName ='" + productName + "' and LPN =" + pnPass1 + " and HPN =" + pnPass2;
}
else
{
= "select CC from List2 where ProductName ='" + productName + "' and PNPass1 =" + pnPass1 + " and PNPass2 =" + pnPass2;
}
= CommandType.Text;
SQLiteDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
accessories = dr[0].ToString();
}
dr.Close();
return accessories;
现在我只能读取符合要求的第一个值,请问各位如何修改可以读取符合要求的所有值
谢谢!!