Update 2 tables

  • Thread starter Thread starter SS
  • Start date Start date
S

SS

Hi

I have this query

Update DISTINCTROW results
SET UserName='::UserName::'
WHERE ID=::ID::

but I want to be able to update a second table called Users from the same
form - is this possible?

Thanks Shona
 
Sorry that's not going to work because the second table has numerous records
and the first only has 1 at the moment.

So I need to be able to update the table results table but add new
information to the second table users.

Don't know if this is possible?
 
Thanks for this I'm not quite sure where I put the last bit

I'm assuming the first bit goes in the head and the second in the body.
Should the first page just be a search form with out a database results
region on it?

Do I need to have 2 database results regions on mynextpage to have both
tables selected?




Murray said:
Here's a good example tutorial (although Dreamweaver focused) for a simple
way to do that....

http://www.charon.co.uk/content.aspx?CategoryID=27&ArticleID=47
[/QUOTE]
[/QUOTE]
 
You need to have two recordsets on the page to have both tables selected.
Each recordset will then be properly written with the AddNew command
followed by the Update command. Having a form is unnecessary - was just
used for this example.

I recently built a process only page to add some data to a table -

<% newEmail = Request.QueryString("email") %>
<% If newEmail = "" Then newEmail="(e-mail address removed)" %>
<%
Dim rsRateUpdateEmail
Dim rsRateUpdateEmail_numRows

Set rsRateUpdateEmail = Server.CreateObject("ADODB.Recordset")
rsRateUpdateEmail.ActiveConnection = MM_RFSOnline_STRING
rsRateUpdateEmail.Source = "SELECT TOP 1 * FROM tableEmailRateUpdate"
rsRateUpdateEmail.CursorType = 0
rsRateUpdateEmail.CursorLocation = 2
rsRateUpdateEmail.LockType = 3
rsRateUpdateEmail.Open()

rsRateUpdateEmail_numRows = 0
%>
<%
rsRateUpdateEmail.AddNew
rsRateUpdateEmail("fieldEmail")= newEmail
rsRateUpdateEmail("fieldUseemail")= 1
rsRateUpdateEmail.Update
Response.Redirect("realtorregisterthanks.asp")
%>

It works very nicely....
 
Back
Top