Hi,
I am trying to make a program that allows one to see a database (MS Access) and add items to the database.
The database works perfectly (update and suchs) but the adding won't, sadly enough.
The error I get is (translated as i'm using a Dutch version): Syntaxisfault in characterline. in query 'item);
Item is the thing that needs to be added.
The code below uses a typeString which is the choice you have to make with a combobox.
Both options won't work, because of the same reason, even though they are different.
string SQLString = "";
if (typeString == "Usable")
{
SQLString = "INSERT INTO Items(Naam) VALUES('" + Item.Replace("'", Item) + ");";
}
else
{
if (typeString == "Combo")
{
SQLString = "INSERT INTO Combo(Naam) VALUES('" + Item.Replace("'", "''") + ");";
}
else
{
MessageBox.Show("You need to select item type!");
}
}