How Do I Insert This Data into my MS Access Database

Joined
Aug 3, 2002
Messages
19
I have added this to a Dataset and am just wondering how i actually insert it into a database... i chose this way of writing i guess because its easier to debug at the end of the day and its definately easier on the eyes... help please?

this is a snippett of the code...

DAdapter.Fill(myDataSet, "PersonalDetails")
myDataRow = myDataSet.Tables.Add("PersonalDetails").NewRow

myDataRow("PatientID") = PatientIDTxt.Text
myDataRow("Name") = NameTxt.Text
myDataRow("Address") = AddressTxt.Text
myDataRow("Category") = CategoryCmb.SelectedIndex
myDataRow("DateCreated") = CreatedTxt.Text
myDataRow("Dentist") = DentistCmb.SelectedIndex
myDataRow("DOB") = DOBTxt.Text

Thank You
 
this is how I add new rows:

Code:
 m_ocbSupplier = New System.Data.OleDb.oleDbCommandBuilder(m_odaSupplier)

Try

    m_drSupplier = m_dtSupplier.NewRow()

    m_drSupplier.BeginEdit()

    m_drSupplier.Item("name") = m_Name

    m_drSupplier.EndEdit()

    m_dtSupplier.Rows.Add(m_drSupplier)

    m_odaSupplier.InsertCommand = m_ocbSupplier.GetInsertCommand

     m_odaSupplier.Update(m_dtSupplier)

     m_dtSupplier.AcceptChanges()

Catch objException As Exception

      ShowError("Location:   Class Supplier" & ControlChars.CrLf & ControlChars.CrLf & "Procedure:  Add() As Boolean" & _
                      ControlChars.CrLf & ControlChars.CrLf & "Error Text: " & objException.Message)

       m_Error = True

       Return False

Finally

       If m_odaSupplier.InsertCommand.Connection.State.Open Then


           m_odaSupplier.InsertCommand.Connection.Close()

        End If

End Try
 
Back
Top