|
-
Jul 14th, 2000, 07:10 PM
#1
Thread Starter
Addicted Member
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?
-
Jul 14th, 2000, 09:28 PM
#2
Fanatic Member
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.
-
Jul 14th, 2000, 09:38 PM
#3
Thread Starter
Addicted Member
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?
-
Jul 14th, 2000, 09:42 PM
#4
Fanatic Member
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.
-
Jul 14th, 2000, 09:59 PM
#5
Thread Starter
Addicted Member
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?
-
Jul 14th, 2000, 10:27 PM
#6
Fanatic Member
Check your email Harrild, you should have it.
-
Jul 14th, 2000, 10:41 PM
#7
Thread Starter
Addicted Member
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?
-
Jul 14th, 2000, 10:50 PM
#8
Fanatic Member
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?
-
Jul 14th, 2000, 10:56 PM
#9
Thread Starter
Addicted Member
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?
-
Jul 14th, 2000, 11:00 PM
#10
Fanatic Member
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.
-
Jul 15th, 2000, 09:40 AM
#11
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|