an i ask for help?
what is wrong with my codes
thanks in advance

Sub show1()
    Dim DReader As MySqlDataReader
    SqlCmd = New MySqlCommand("SELECT * FROM book WHERE accesion_num = '" & b_id & "' ", SqlCon)
    DReader = SqlCmd.ExecuteReader
    While DReader.Read
        accnum.Text = DReader.Item(0)
        isbn.Text = DReader.Item(1)
        txteditbooktittle.Text = DReader.Item(2)
        txteditbookauthor.Text = DReader.Item(3)
        txteditbookpiblisher.Text = DReader.Item(4)
        DateTimePicker1.Text = DReader.Item(5)

    End While
    DReader.Close()
End Sub

Sub update1()

    Dim DSet As New DataSet
    DAdaptr = New MySqlDataAdapter("UPDATE book SET accession_num ='" & accnum.Text & "',isbn='" & isbn.Text & "',tittle='" & txteditbooktittle.Text & "',author'" & txteditbookauthor.Text & "',publisher ='" & txteditbookpiblisher.Text & "',date_of_acquisition ='" & DateTimePicker1.Value & "'where accesion_num='" & b_id & "'", SqlCon)
    DAdaptr.Fill(DSet, "book")
    MsgBox("Success edit", vbOKOnly)
    If MsgBoxResult.Ok = 1 Then
        usercontrol.Show()
        usercontrol.showUser()
        Me.Hide()
    End If
End Sub

Edited 2 Years Ago by Reverend Jim: fixed formatting

Thanx Accepted.

what is wrong with my codes

1) I don't see any definition for SqlCon.
2) No definition for b_id.
3) This DReader = SqlCmd.ExecuteReader should be DReader = SqlCmd.ExecuteReader().
4) Line 11, this DateTimePicker1.Text should be DateTimePicker1.Value.And the list goes on . . . .

This article has been dead for over six months. Start a new discussion instead.