0

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()
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by finito
0

Not sure what the problem is can you elaborate?

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.

From What I understand you are saying you are loading the values in Form Load, and then when the click a button called change, something gets updated?

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?

I don't know what you are saying. Are you trying to ask how to refresh the vales?

if so move your form Load code into a function and call that function in form load and when you finish your edit.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.