C#
C#

help

Root Question Message

Koopamillion
Koopamillion10/8/2022
SQL Error when trying to get an ID

I'm trying to add username password and email to my users table
And then get the ID of this new user.
            SqlCommand cmd = new SqlCommand("insert into Users values(@username,@password,@email)", cn);
            cmd.Parameters.AddWithValue("username", info["username"]);
            cmd.Parameters.AddWithValue("password", encryptedPW);
            cmd.Parameters.AddWithValue("email", info["email"]);
            int id = (int)cmd.ExecuteScalar();

however I get this error:

System.Data.SqlClient.SqlException: 'Column name or number of supplied values does not match table definition.'
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy