hy :icon_cheesygrin:
We are doing in the page load event we will read the data to the database and put on the page, and the Change button and click event, we are changing through the update the table values in the database.
Will carry the edit button when he returns to make the page load and replace the initial values? and inserts the same? Is this the reason not to get any change?
HElp Guys ;)
Protected Sub bt_alterar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bt_alterar.Click
Dim id As Integer = Request.QueryString("id")
Dim imagemnome As String
If (filename.PostedFile.FileName <> "") Then
filename.PostedFile.SaveAs(Server.MapPath("~") + "/images/filmes/" + filename.PostedFile.FileName)
imagemnome = "images/filmes/" + filename.PostedFile.FileName
Else
imagemnome = Lbl_imagename.Text
End If
Dim estreia As String
estreia = txt_dia.Text + "-" + txt_mes.Text + "-" + txt_ano.Text
Dim MySQL As String = "update filme set imagem=@imagem, nome=@nome, genero=@genero, origem=@origem, estreia=@estreia, elenco=@elenco, trailer=@trailer, sinopse=@sinopse where (id=@id);"
Dim strConn As String = ConfigurationManager.ConnectionStrings("ConnectionString-magazine").ConnectionString
Dim myConn As OleDbConnection = New OleDbConnection(strConn)
Dim TheCommand As OleDbCommand = New OleDbCommand(MySQL, myConn)
TheCommand.Parameters.AddWithValue("@id", id)
TheCommand.Parameters.AddWithValue("@imagem", imagemnome)
TheCommand.Parameters.AddWithValue("@nome", txt_nome.Text)
TheCommand.Parameters.AddWithValue("@genero", txt_genero.Text)
TheCommand.Parameters.AddWithValue("@estreia", estreia)
TheCommand.Parameters.AddWithValue("@elenco", edt_elenco.Content)
TheCommand.Parameters.AddWithValue("@trailer", edt_youtube.Content)
TheCommand.Parameters.AddWithValue("@sinopse", edt_sinopse.Content)
myConn.Open()
TheCommand.ExecuteNonQuery()
myConn.Close()
lbl_nome.Text = estreia.ToString()