I'm trying to make a program in Visual C# that will play music with a specific condition.
At first I'll show you some code I already have.
I think That'll explain what I want alot more than trying to explain it all.
Code: Select all
{
SongsDB.SDBApplication SDB = new SongsDB.SDBApplication();
SDB.ShutdownAfterDisconnect = false;
// As an example I use the condition that the Artists has to be Linkin Park
var Query = "Artist='Linkin Park'";
// Get all songs by the artist "Linkin Park"
var QueryData = SDB.Database.QuerySongs(Query);
// Create a Songlist to add the songs to
var SongList = new SDBSongList();
while (true)
{
// If EOF, we've seen all the songs by 'Linkin Park', so break out of the loop
if (QueryData.EOF)
{
break;
}
else
{
// Add this song to the SongList
SongList.Add(QueryData.Item);
}
QueryData.Next();
}
// Close the connection to the database
SDB = null;
}
But when I try to run this code, the program will fail on
Code: Select all
SongList.Add(QueryData.Item);
And the SongList.Add() requires a SDBSongData (http://www.mediamonkey.com/wiki/index.p ... gList::Add)
If I'm right the QueryData (SDB.Database.QuerySongs) returns a SDBSongIterator object, which can handle an 'EOF', an 'Item' and a 'Next' (http://www.mediamonkey.com/wiki/index.p ... ngIterator)
As you can see in my code the 'EOF' Property Get and the 'Next' method do work, but the 'Item' Property get keeps giving me an error.
If anybody could please help me and tell me what I'm doing wrong over here I'd really appreciate that.
Thanks in advance for the trouble to be taken.