Results 1 to 11 of 11

Thread: Database Updating

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132

    Question

    ok i am working on a database program i was wondering can you add a new record to a database using textboxes if so how?
    Reality is an illusion caused by by lack of drugs

    Is this real or am i just having a dream?

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    Harrild,

    This is using ADO.

    Say you have two textboxes, txtBandName and txtSong. You also have to columns in the DB one named BandName the other Song. To insert a record you would use the following SQL string:

    SQL = "INSERT INTO BANDS (BandName, Song) VALUES ('" & txtBandName & "', '" & txtSong & "')"

    This would be passed to the Recordset object's open method like this:

    rstBands.open SQL,DataConn

    I haven't tried it using the Grid and ADO data control's RecordSource property so I'm not totally sure if you can. Maybe someone else can shed a little light on it.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132
    ok looks simple enough...i think. so thats it all i need to do is edit that for an update button (i got 7 fields to add in to one database at once)?
    Reality is an illusion caused by by lack of drugs

    Is this real or am i just having a dream?

  4. #4
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    It's more involved than that. But that is where all the action of inserting a record happens. If you'd like I can email you some of my code from class that could get you started, well if I can find it that is. We finished up with that about a week ago and I'm still looking for the class disks.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132
    Psyrus thanks i would gladly appreciate it if you could email me the code
    send it to [email protected] please.
    Reality is an illusion caused by by lack of drugs

    Is this real or am i just having a dream?

  6. #6
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    Check your email Harrild, you should have it.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132
    yep i got it i just need SP3 now....
    Reality is an illusion caused by by lack of drugs

    Is this real or am i just having a dream?

  8. #8
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    Sorry, I was hoping you had it. Does anyone know if you need SP3 to use components from a program(source code) written in VB6 w/SP3 in one that doesn't have it? Did you try it Harrild? Did it work or did you get an error about missing components or something?

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132
    no it didnt work w/o SP3...and i cant download it either cos i aint got no hard disk space left....
    Reality is an illusion caused by by lack of drugs

    Is this real or am i just having a dream?

  10. #10
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    I think you can open the files in Word or Notepad, not sure which, to view the source code. I've only heard/read it before, never tried it.

  11. #11
    New Member
    Join Date
    Jul 2000
    Location
    UK Essex
    Posts
    12
    I think it is easier using ADO like this

    once you have your open recordet - AdoRS

    adors.addnew
    adors.movelast

    adors!band = txtBand.text
    adors!song = txtSong.text

    adors.update

    If you are doing a group update you might be better using the begintrans commit trans method to stop data being half written.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width