Updating more than one table

Results 1 to 7 of 7

Thread: Updating more than one table

  1. #1
    Hell Bent Pyro Guest

    Default Updating more than one table

    how do I update more than one table within the same asp page(within a few lines of eachother) <BR>ie.<BR>---------------------------------------------------------------<BR>strConnectionString = "auction"<BR>set rst = Server.CreateObject("ADODB.Recordset")<BR>strSQL = "INSERT INTO tblAuctions (StartDate, EndDate, SellerID)" &_<BR> "VALUES (&#039" & FormatDateTime(Now) &_<BR> "&#039, &#039" & AddDays(FormatDateTime(Now),duration)&_<BR> "&#039, &#039" & Request.Form("SellerID") & "&#039)"<BR>rst.open strSQL, strConnectionString<BR>strSQL = "SELECT max(AID) as AID FROM tblAuctions"<BR>rst.open strSQL, strConnectionString<BR>intAID = rst(0)<BR>---------------------------------------------------------------<BR>I have the database in a System DNS and since I dont expect a large ammount of people to access the side I dont really need to change this do I? if I do where do I learn to get the DNSLess working??<BR><BR>Also what permissions should be set on a database for people to read the database update it and then close it at the same time as eachother I&#039m running Windows 2000 pro and server

  2. #2
    peterjl@austec.net.au Guest

    Default RE: Updating more than one table

    If you want to update more than one table you can either do it through a table join, or open more recordsets. (DON&#039T FORGET TO CLOSE THEM WHEN YOU ARE FINISHED WITH THEM, AND SET THEM TO NOTHIING:<BR>&#060;%rs.close<BR>set rs=nothing%&#062;<BR><BR>About DNSless:<BR>Not much to learn:<BR>&#060;%<BR>dim Conn, Rs<BR>set Conn=Server.CreateObject("ADODB.Connection")<BR>Co nn.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath("/VirtuaalPathToYourDb") & ";"<BR>set Rs=Server.CreateObject("ADODB.RecordSet")<BR>rs.Op en sqlQueryStr, Conn, 2,3,1<BR>%&#062;<BR><BR>The above is for an Access DB. If you know the filesystem path (eg E:INETPUBDATA) you won&#039t need to use the MapPath method.

  3. #3
    iyyappan n iyer Guest

    Default RE: Updating more than one table

    i don&#039t mean to give smart-alec advice, but u should read the book "Beginning ASP Databases" by John Kauffmann, u will find answers to all your questions.

  4. #4
    Hell Bent Pyro Guest

    Default RE: Updating more than one table

    um, ok then, well I have tried closing the RS but it came up with a message:<BR>------------------------------------------------------<BR>Error Type:<BR>ADODB.Recordset (0x800A0E78)<BR>Operation is not allowed when the object is closed.<BR>------------------------------------------------------<BR> so how would I got about table joining and yes I&#039m using Access 2000<BR><BR>I think my main problem is the permissions are not set correct. but I could be wrong..

  5. #5
    Hell Bent Pyro Guest

    Default RE: Updating more than one table

    um, I&#039m a Student at UNI, I cant afford to buy books and I have checked all the library&#039s arround here and no book is in there that was published earler than 10 years ago!

  6. #6
    Join Date
    Dec 1969

    Default RE: Updating more than one table

    That&#039s cool dude. We never stop learning.

  7. #7
    iyyappan n iyer Guest

    Default RE: Updating more than one table

    well, a connection object can do any operation in the tables contained within a database, that the connection object represents.<BR><BR>so , first create connection<BR>then update table 1 using the connection object<BR>next update table 2 and so on<BR><BR>****************<BR>in case the tables are in different databases<BR>first create connection obj for database 1<BR>update tables within that database<BR>release connection object<BR><BR>then create another connection obj for the second database file<BR>update tables in this database.<BR><BR>hope this helps.<BR><BR>guess what ? where i studies, when they were teaching vb5 , they had vb4 book, and when they were teaching vb6 , best they had was a vb5 book. if u asked for the latest, their standard answer was, &#039headquarters is processing our request&#039.

Posting Permissions

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