Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old January 16th, 2004, 01:56 PM
paulevs paulevs is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 24 paulevs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Adding data to multiple tables (VB)

Does anybody know how to add data to multiple access tables through a vb form. I need to pass the UniqueID from my identification table to all my other related tables in the database, so when my users enter the data into the master table they are also entering the uniqueID into the other tables.
Thanks..
Help......................

Reply With Quote
  #2  
Old January 16th, 2004, 03:05 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,738 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 1 h 41 m 10 sec
Reputation Power: 443
you would have to run multiple insert statements to insert the data in the tables.

Reply With Quote
  #3  
Old January 18th, 2004, 01:04 PM
paulevs paulevs is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 24 paulevs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for that will try it out on Monday..

Reply With Quote
  #4  
Old January 26th, 2004, 03:24 AM
GenkiDave's Avatar
GenkiDave GenkiDave is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Canada
Posts: 60 GenkiDave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Question Care to elaberate on that?

Hi there! Would you care to elaberate and give an exaple?

I seem to have A VBScript error:

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/add_backup.asp, line 30, column 24
rsAddMovie.Open strSQL1 strSQL2, adoCon

Column 24 is immediately after the 1 in: strSQL1.

Here's the code. I'll bold what ever I feel is important to see.

It works great with adding info to a database with one table in a database, but I need to add info to two tables.


/////////////////////////////ASP Code/////////////////////////////////


<%@ LANGUAGE="VBScript" %>

<%
'Dimension variables
Dim adoCon
Dim rsAddMovie
Dim strSQL1
Dim strSQL2

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using DSN connection
adoCon.Open "DSN=movie"

'Create an ADO recordset object
Set rsAddMovie = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variables with the SQL statements to query the database
strSQL1 = "SELECT tblMovies.Name, tblMovies.GenreID, tblMovies.Director, tblMovies.YearReleased, tblMovies.Length, tblMovies.RatingID, tblMovies.Review, tblMovies.CodecID, tblMovies.CDs, tblMovies.Notes FROM tblMovies;"
strSQL2 = "SELECT tblActors.Fname, tblActors.Lname;"

'Set the cursor type we are using so we can navigate through the recordset
rsAddMovie.CursorType = 2

'Set the lock type so that the record is locked by ADO when it is updated
rsAddMovie.LockType = 3

'Open the recordset with the SQL query
rsAddMovie.Open strSQL1 strSQL2, adoCon


'Tell the recordset we are adding a new record to it
rsAddMovie.AddNew

'Add a new record to the recordset
rsAddMovie.Fields("MovieName") = Request.Form("txtMovieName")
rsAddMovie.Fields("GenreID") = Request.Form("optGenre")
rsAddMovie.Fields("Director") = Request.Form("txtDirector")
rsAddMovie.Fields("YearReleased") = Request.Form("txtYearReleased")
rsAddMovie.Fields("Length") = Request.Form("Length")
rsAddMovie.Fields("RatingID") = Request.Form("optRating")
rsAddMovie.Fields("Review") = Request.Form("txtReview")
rsAddMovie.Fields("CodecID") = Request.Form("txtCodec")
rsAddMovie.Fields("CDs") = Request.Form("txtCds")
rsAddMovie.Fields("Notes") = Request.Form("txtNotes")
rsAddMovie.Fields("Fname") = Request.Form("txtFname")
rsAddMovie.Fields("Lname") = Request.Form("txtLname")

'Write the updated recordset to the database
rsAddMovie.Update

'Reset server objects
rsAddMovie.Close
Set rsAddMovie = Nothing
Set adoCon = Nothing

'Redirect to the guestbook.asp page
Response.Redirect "http://localhost/movie.asp"
%>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Adding data to multiple tables (VB)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway