我需要从我的数据库表中获取“Tname”列中具有相同值“r_c”的所有行。
public ArrayList<String> getDb2(String r_c ){
ArrayList<String> dd = new ArrayList<>();
String KW = r_c.toString();
String selection = "Tname " + "like ? ";
Cursor cursor = db.query("info", null,selection,new String[]{"%"+KW+"%"},null,null,null);
if(cursor !=null && cursor.moveToFirst()){
do{
dd.add(cursor.getString(0)+"\n " + "From : " +cursor.getString(2)+"\n "+"price : " + cursor.getString(1)+" \n "+"Nots : " + cursor.getString(3));
}
while (cursor.moveToNext());
}
return dd ;
}
答案 0 :(得分:0)
回答手机,对不起,如果代码中有任何错误,但想法很简单。
function manuf {
echo -n "Manufacturer: " ; read userManuf
varManuf=$(mysql -D snipeit -e "SELECT count(id) FROM manufacturers;")
countManuf=$(echo $varManuf | awk '{print $2}')
if [ $userManuf -ne 0 ] && [ $userManuf -le $countManuf ]; then
assetModelManuf=$userManuf
elif [ "$userManuf" = "n" ] || [ "$userManuf" = "N" ]; then
echo -n "Type new manufacturer name: " ; read userNewManuf
assetModelManuf=$userNewManuf
else echo "Try again!" && manuf
fi
}