#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    2
    Rep Power
    0

    Question Need help in manipulating Database on VB.net


    Good day Devshed Forums!
    I've been reading quite a lot of threads here, and I finally decided to register for good. Atlast!


    okay, I'm having a hard time on this "DVD Rental" Program with a button that is labeled "Rent DVD". I'm new in programming, please bare with me.

    and the "Rent DVD Button" Contains the following codes:



    Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
    Dim i As Integer
    Dim rmovie As String
    Dim rserial As Integer
    Dim rw As DataRow
    'Add a new row to the Student table.
    rw = Form3.Database2DataSet.Tables(0).NewRow
    rmovie = InputBox("Enter Movie Name:")
    rserial = InputBox("Enter Serial:")

    rw.Item("Movie") = rmovie
    rw.Item("Serial") = rserial

    Try
    Form3.Database2DataSet.Tables(0).Rows.Add(rw)
    'Update the Student table in the testdb database.
    i = Form3.Table2TableAdapter.Update(Form3.Database2DataSet)
    Catch ex As Exception
    MessageBox.Show(ex.Message)
    End Try
    'Displays number of rows updated.

    Me.Close()
    Form3.Show()

    End Sub



    -and this seems to be working. This will bring me on the next form with the stuffs that I've entered in the InputBox saved on a database.




    My problem is, I want to create a conditional statement (maybe "If then") under a "Return DVD Button" that will provide an input box that will ask values of what DVD I want to return as well as its serial number and then checks if the serial number that I've entered is correct according on the database record.

    BUT I have no idea of what codes I will be needing in order to have a conditional statement that will refer its values on the database records.


    Is this idea possible? Could you guys help me with the codes that I will be needing, or give me a better idea?



    Sorry If I can't provide photos for better reference. This forum wouldn't just allow new users like me to post URL's.

    Additional Info: I'm using VS11.
  2. #2
  3. No Profile Picture
    Stumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,409
    Rep Power
    4538
    Do you have some code that isn't working? If so post a relevant snip and any errors or other steps you've taken to try to debug.
    ======
    Doug G
    ======
    It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

IMN logo majestic logo threadwatch logo seochat tools logo