Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - How to add to 2 Databases?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to add to 2 Databases?

 Post Reply Post Reply
Author
faubo View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2002
Location: Brazil
Status: Offline
Points: 560
Post Options Post Options   Thanks (0) Thanks(0)   Quote faubo Quote  Post ReplyReply Direct Link To This Post Topic: How to add to 2 Databases?
    Posted: 13 May 2003 at 4:07pm

Hello,

Finally I got some time to get back to asp.

Ok, what I want to do is:

I have a form and I will add the information put on it in a Access DB,

then, in the same asp page,

I will add the same information PLUS the autonumber generated by the first DB in a second Access DB (this one in just a number field, not automatic)

How is the bast way to get this number generated in the first DB?

Thanks!

 

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 13 May 2003 at 4:24pm

You can use seomthing like:
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "tUsers", "AutoExample", adOpenKeySet, adLockPessimistic, adCmdTable
Rs.AddNew
Rs("UserName") = Request.Form("USERNAME")
Rs("UserEmail") = Request.Form("USEREMAIL")
Rs.Update
lUserID = Rs("UserID")                           'This is the Autonumber that you just inserted. 
Rs.Close Set
Rs = Nothing

Back to Top
faubo View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2002
Location: Brazil
Status: Offline
Points: 560
Post Options Post Options   Thanks (0) Thanks(0)   Quote faubo Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2003 at 12:55pm

Thanks Michael!

It worked.

Now... another question:

I have two Access databases with the exact the same structure (each one 15mb, I split because of server usage).

Is there a way to make a search in both of them, returning the results as if was just one DB (in this case I don't care about the usage)?

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.