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

Recommended Answers

All 3 Replies

please explain why you think something is wrong?

how can we help you if you yourself don't know what's your problem..

Member Avatar for Rahul47

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 . . . .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.