Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to update a dataset

Status
Not open for further replies.

purplehaze1

Programmer
Jul 23, 2003
86
US
I did following for update, It used to work before, it's not working again. what could be wrong with it?

Many Thanks.


Public Sub SaveAddress()
Dim cn As New OleDbConnection(Login.SQL_ConnectionString)
Dim da As New OleDbDataAdapter("SELECT * FROM t_recip_address WHERE recip_addr_id=101", cn)
Dim cb As New OleDbCommandBuilder(da)
Dim ds As New DataSet()

da.Fill(ds, "PatientAddress")

Dim dr As DataRow
If ds.Tables(0).Rows.Count = 0 Then
dr = ds.Tables(0).NewRow()
Else
dr = ds.Tables(0).Rows(0)
End If

If m_Delete Then
dr.Delete()
End If

dr("recip_id") = m_recipientID
dr("addr_type_id") = CType(m_addrTypeID, Integer)
dr("addr1_txt") = IIf(m_Address1 = String.Empty, String.Empty, m_Address1)
dr("addr2_txt") = IIf(m_Address2 = String.Empty, String.Empty, m_Address2)
dr("addr3_txt") = IIf(m_Address3 = String.Empty, String.Empty, m_Address3)
dr("city_nme") = IIf(m_City = String.Empty, String.Empty, m_City)
dr("state_id") = m_StateID
dr("country_id") = m_CountryID
dr("zip_cde") = IIf(m_Zip = String.Empty, String.Empty, m_Zip)
dr("start_dte") = startDate
dr("end_dte") = endDate
dr("create_dte") = CType(Today.Now, Date)
dr("lst_updt_dte") = CType(Today.Now, Date)
dr("lst_updt_id") = IIf(Login.m_UserName = String.Empty, String.Empty, Login.m_UserName)

da.Update(ds, "PatientAddress")


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top