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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database and dataset

Status
Not open for further replies.

CookieNZ

MIS
Apr 22, 2002
48
0
0
NZ
Using insert and update commands I update an access database immediately, but do not update the dataset in memory. How do I do this?

I don't think dropping the connection removes the dataset from memory?

I would have though that
dbsupport.update(dssupport, "SupportCall") would do the trick, but nothing happens.
 
Use the ExecuteNonQuery method of the command object. Below is an example

Dim cdSubUpdate As New SqlClient.SqlCommand()

cdSubUpdate.Connection = cnEDI
cdSubUpdate.CommandText = "update ediSubscriber set accepted = @accepted, pickenrolleessn = @Pickenrolleessn, lnameleven = @lnameleven, fnameleven = @fnameleven, addrmatch = @addrmatch, validtotal = @validtotal, nameflip = @nameflip where recnum = @recnum"
cdSubUpdate.Parameters.Add("@Accepted", SqlDbType.Int)
cdSubUpdate.Parameters.Add("@PickEnrolleeSSN", SqlDbType.Char, 15)
cdSubUpdate.Parameters.Add("@LnameLeven", SqlDbType.Int)
cdSubUpdate.Parameters.Add("@FnameLeven", SqlDbType.Int)
cdSubUpdate.Parameters.Add("@AddrMatch", SqlDbType.Int)
cdSubUpdate.Parameters.Add("@ValidTotal", SqlDbType.Int)
cdSubUpdate.Parameters.Add("@NameFlip", SqlDbType.Int)
cdSubUpdate.Parameters.Add("@RecNum", SqlDbType.Int)

If dsClaims.Tables("pathl23").Rows.Count = 1 Then
cdPatUpdate.Parameters(0).Value = dsClaims.Tables("PatHL23").Rows(0)!accepted
cdPatUpdate.Parameters(1).Value = dsClaims.Tables("PatHL23").Rows(0)!PickPatientCode
cdPatUpdate.Parameters(2).Value = dsClaims.Tables("PatHL23").Rows(0)!LnameLeven
cdPatUpdate.Parameters(3).Value = dsClaims.Tables("PatHL23").Rows(0)!FnameLeven
cdPatUpdate.Parameters(4).Value = dsClaims.Tables("PatHL23").Rows(0)!AddrMatch
cdPatUpdate.Parameters(5).Value = dsClaims.Tables("PatHL23").Rows(0)!ValidTotal
cdPatUpdate.Parameters(6).Value = dsClaims.Tables("PatHL23").Rows(0)!NameFlip
cdPatUpdate.Parameters(7).Value = dsClaims.Tables("PatHL23").Rows(0)!DOBMatch
cdPatUpdate.Parameters(8).Value = dsClaims.Tables("PatHL23").Rows(0)!Recnum
End If

cdPatUpdate.ExecuteNonQuery()

Hope this helps.

O.
 
Sorry, my example shows the wrong Dim variable (copied code from two different places by mistake). I should have put:

Dim cdPatUpdate As New SqlClient.SqlCommand()

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top