The programm i wrote throws up an Exception because of this code:
queryString = String.Format("INSERT INTO Playlists (PlaylistID, PlaylistName, PlaylistCreator) VALUES ('{0}', '{1]', '{2}');", CurrentPlaylistID, playlistInfo[1], playlistInfo[0]);
All Variables are Strings. I also have a similiar String.Format after this an it works fine. There are also 3 Variables, all are Strings.
Can't find a way to solve this Error, it says formatting Error, but why?
Hope you can help me
Don't fix the exception - stop constructing SQL like this to start with. (The exception is due to a typo as Pheonyx suggested, but don't just fix that.)
Instead, use parameterized SQL, and specify the values as parameter values. Otherwise:
See the documentation for SqlCommand.Parameters
for more details - we can't tell what database you're targeting to give you more specific help, but typically you'll find a properties called Parameters
on the relevant command class.
See more on this question at Stackoverflow