how to update record in database??

  • 13 years ago

    I have a problem with updating the record into database, can someone help me??
    following is the code that i used to add new record into database (this code i get it from internet)
    but, i dont know how to update the record.please help.


           Dim i As Integer
           Dim Cname, ReservationNo, CarNo, LotNo, CID As String
           Dim rw As DataRow
           'Dim ReservationDate As Date


           ReservationNo = InputBox("Enter the Reservation no:")
           CID = InputBox("Enter the customer ID:")
           Cname = InputBox("Enter the Name of the Customer:")
           CarNo = InputBox("Enter the Car no:")
           rw.Item("ReservationNo") = ReservationNo
           rw.Item("CustomerID") = CID
           rw.Item("Name") = Cname
           rw.Item("ReservationDate") = ReservationDate
           rw.Item("CarNo") = CarNo
         
           Try
               DataSet11.Tables(0).Rows.Add(rw)
               'Update the reservation table in the db database.
               i = OleDbDataAdapter2.Update(DataSet11)
               MessageBox.Show("New record has been added into database")
           Catch ex As Exception
               MessageBox.Show(ex.Message)
           End Try


      End Sub

  • 13 years ago

    Hi


    I suggest you take a read of http://www.developerfusion.com/show/4278/ . This gives you an intro to ADO.NET and how to update records

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The trouble with programmers is that you can never tell what a programmer is doing until it's too late.” - Seymour Cray