I’m trying to create a table in my database through C# using the following method:
private static void CreateTables()
{
_commandtext = "CREATE TABLE Users(" +
"ID Integer PRIMARY KEY, " +
"Username Text(20), " +
"Password Text(25), " +
"IBAN Text(18)" +
");";
_command = new OleDbCommand(_commandtext, _connection);
_connection.Open();
int number = _command.ExecuteNonQuery(); <<< Error
_connection.Close();
}
Somehow it returns an error: “Syntaxerror in fielddefinition”
What am I doing wrong?
Edit: Solved but nevertheless: I’m using this for Access
Have you tried adding square brackets around your names?
Maybe your DB thinks you’re referencing other fields instead of creating new ones with the names you put in.