Can some one here tell me what is wrong with my code? Benn spending like an endless hour finding the error.
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
SqlCommand cmd = new SqlCommand("Insert into CarReserve(UserName,Manufacture,Model,Plate,DateReturn,TimeReturn) Values (@Username1,@Manufacture1,@Model1,@Plate1,@Date1,@TimeReturn1)", conn);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Username1", Label1.Text);
cmd.Parameters.AddWithValue("@Manufacture1", Label3.Text);
cmd.Parameters.AddWithValue("@Model1", Label4.Text);
cmd.Parameters.AddWithValue("@Plate1", Label5.Text);
cmd.Parameters.AddWithValue("@Datel", Label6.Text);
cmd.Parameters.AddWithValue("@TimeReturnl", Label7.Text);
conn.Open();
cmd.ExecuteNonQuery();
Response.Redirect("HomeUser.aspx");
}
The error is must declare the scalar var @Date1. Thanks in advance.