I want to register movies, where you have the fields: txtname, txtanio, txtweb, txt description.
In the database the Id is incredable.
But when I press the high button I get the following error:
And the following code for when you load the form is:
private void Alta_Load(object sender, EventArgs e)
{
conexion = new SqlConnection("DataSource = EMILIANO-PC; InitialCatalog = VideoClub; Integrated Security = True");
adaptador = new SqlDataAdapter();
SqlCommand alta = new SqlCommand("insert into peliculas values (@nombre_pelicula, @web_pelicula, @descripcion, @anio)", conexion);
adaptador.InsertCommand = alta;
adaptador.InsertCommand.Parameters.Add(new SqlParameter("@nombre_pelicula", SqlDbType.VarChar));
adaptador.InsertCommand.Parameters.Add(new SqlParameter("@web_pelicula", SqlDbType.VarChar));
adaptador.InsertCommand.Parameters.Add(new SqlParameter("@descripcion", SqlDbType.VarChar));
adaptador.InsertCommand.Parameters.Add(new SqlParameter("@anio", SqlDbType.Int));
}
I can not find the error.