Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[Help]vb.net

jhaypheee

Apprentice
Advanced Member
Messages
55
Reaction score
0
Points
26
mga kaSB patulong po. hindi po nya maupdate yung database ko. pero pag niRUN ko yung .exe sa debug folder naUUPDATE nya yung database sa debug folder din. eto po yung code ko. thanks in advance

Code:
MODULE
Public con As New OleDb.OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;Data Source = db.mdb")

Code:
 Public Sub Update_Rec()
        con.Open()

        Dim cmd As OleDb.OleDbCommand
        Dim str As String


        str = "UPDATE tblpass SET Username = @Username, [Password] = @Password, User_type = @User_type, FullName = @FullName WHERE ID = '" & TextBox1.Text & "' "

        cmd = New OleDb.OleDbCommand(str, con)
        cmd.Parameters.AddWithValue("@Username", txtuser.Text)
        cmd.Parameters.AddWithValue("@Password", txtpass.Text)
        cmd.Parameters.AddWithValue("@User_type", ComboBox1.Text)
        cmd.Parameters.AddWithValue("@FullName", txtname.Text)


        cmd.ExecuteNonQuery()
        


        MsgBox("Successfully updated")


        'Populate the listview
        Me.ListView1.Items.Clear()
        Dim dt As New DataTable("tblpass")
        Dim rs As New OleDb.OleDbDataAdapter("select * from tblpass", con)
        rs.Fill(dt)

        Dim myRow As DataRow

        For Each myRow In dt.Rows
            ListView1.Items.Add(myRow.Item("ID"))
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(myRow.Item("Username"))
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(myRow.Item("Password"))
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(myRow.Item("User_type"))
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(myRow.Item("FullName"))
        Next
        rs.Dispose()

        con.Close()

    End Sub

- - - Updated - - -

salamat po sa mga makakatulong
 
Last edited:
Back
Top Bottom