# Why would selecting a lot of rows crash my game? [closed]

I have a databse that contains: id , playlistname , playlistnum and I want to get alll the rows where playlistname = "CoolPlaylist" and I want to parse them 1 by 1, so I thought of doing this:

String name = "CoolPlaylist";
String[] columns = String[] {id , playlistname , playlistnum};
Cursor c = myDatabase.query(TABLE_NAME, columns, key_playlistname +"="+name,
null, null, null, null);


but when I do this, the code crashes. Does somebody know what the problem probably is?

• I guessing it's something to do with those nulls. You need to debug the program. Read the error message, they're typically very helpful. Use the debugger, step through the code, ensure your values are set the way you expect them to be set.
– House
Jul 15, 2012 at 15:13

key_playlistname +"="+name

key_playlistname + "= '" + name + "'"