Executing the below code gives me error. Column 'Username' cannot be null
Values are being passed in the variables. But I think the OdbcCommand
statement is not prepared properly.
OdbcCommand cmd = new OdbcCommand
{
CommandText =
"INSERT INTO orders(username,name,email,address,contact_number,html_email)
VALUES(@username,@name,@email,@address,@contact_number,@html_email)",
Connection = Con
};
cmd.Parameters.AddWithValue("@username", username);
cmd.Parameters.AddWithValue("@name", name);
cmd.Parameters.AddWithValue("@email", email);
cmd.Parameters.AddWithValue("@address", add);
cmd.Parameters.AddWithValue("@contact_number", contact);
cmd.Parameters.AddWithValue("@html_email", table);
billid = cmd.ExecuteScalar().ToString();