My linq query won't insert my data. What am I doing wrong?

    class Query
    {
        musicEntities db = new musicEntities();

        public bool findArtist(string artist)
        {
            bool status = db.Artists.Any(w => w.Name.Contains(artist));
            return status;
        }
        public void insertArtist(string artist)
        {
            if (findArtist(artist) == false)
            {
                Artist art = new Artist
                {
                    Name = artist
                };
                db.Artists.AddObject(art);
                db.SaveChanges();
            }
        }

    }

Why do you think it isn't inserting? When you check the database after you've run your program it isn't there?

You do realize that Visual Studio makes a copy of file based databases when you run in debug mode and any changes you make will not persist in the database. You can see the copy in the debug directory while you are running your program.

Thank you. I did no realized that. I was able to connect to that database and display the data. Thanks!

This question has already been answered. Start a new discussion instead.