[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

Database update via winsock control

Experts,

I am using the winsock control to connect a PDA to an Access database.  This works by :-

The PDA sending the SQL command to the Winsock Server
The Winsock server then processes the command
The Winsock server then returns the records back to the PDA.  

This process is working fine.

However I now need the ability to perform such functions as record set UPDATE / ADD NEW etc.

Does anyone have any ideas on how to accomplish this???

Example of sending the Records to the Client

    Dim buff As String
    Dim x As Integer
    Dim iRecords As Long
    Dim iFields As Integer
    Rs.MoveFirst
    While Not Rs.EOF
        iFields = Rs.Fields.Count
        For x = 0 To Rs.Fields.Count - 2
            buff = buff & Rs.Fields(x).Value & "|"
        Next x
        buff = buff & Rs.Fields(x).Value & "|"
        iRecords = iRecords + 1
        Rs.MoveNext
    Wend
    Rs.Close
    Set Rs = Nothing
    buff = buff & "~"
    Sbuff = "DATAOK" & Format(iRecords, "000000") & "," & Format(iFields, "0000") & "," & buff & "~"
   
0
samstarkey
Asked:
samstarkey
1 Solution
 
TreyHCommented:
When the winsock server sends the records to the PDA,  include the record ID (Primary Key). The PDA could then send an update SQL statement for the winsock server to process.

"UPDATE MyTable SET Field1 = 'Hello', Field2 = 'World' WHERE ID = 1"

The problem you'll run into is record locking with more than one user. Will user1 change the same record before user2, if so user2's changes will overwrite.
0
 
samstarkeyAuthor Commented:
Thanks TreyH,

Didn't do my research very well.  Standard SQL statements...  I generally work by DAO and record sets so rarely dulge into core SQL

Thanks anyway, pointed me in the dircetion i needed
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now