|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Updating records with a join
The following form post data into itslef through a join statement. the contact and ticket tables. The ticket ID field is read only as I don't want that updated.
Through the form action I want to be able to update the existing record. Is it possible to run an update through a join? The statement selects a ticket and the associated contact. The user should be able to change the contents of any field and then hit the submit button the update save the ticket. The form: <!-- #include virtual="login3/adovbs.inc" --> <HTML> <HEAD> <TITLE>Search_Test</title> </HEAD> <% 'specify the provider strProvider="Driver={SQL Server};Server=SPARKDLE-LPSJXL;Database=Login;Uid=sa;Pwd=sa;" 'define the inner join query strQuery = "SELECT tcontact.firstname, tcontact.lastname, tticket.ticketid, tticket.urgency, tticket.description, tticket.probdescription, tticket.probresolution FROM tcontact inner JOIN tticket ON tcontact.contactid=tticket.contactid" 'create and open the recordset set rsJoin=Server.CreateObject("ADODB.Recordset") rsJoin.Open strQuery, strProvider, , , adCmdText %> <!-- <% 'cycle thru the record set and display each row results 'do until rsJoin.EOF %> --> <BODY> <TABLE> <form action= "searchtest_update.asp"> <TR> <TD>Firstname</TD> <TD><INPUT TYPE="text" NAME="ticket" value=<% Response.Write rsJoin("firstname")%>> </TD> </TR> <TR> <TD>Lastname</TD> <TD><INPUT TYPE="text" NAME="ticket" value=<% Response.Write rsJoin("lastname")%>> </TD> </TR> <TR> <TD>Ticket ID</TD> <TD><% Response.Write rsjoin("ticketid")%> </TD> </TR> <TR> <TD>Subject</TD> <TD><INPUT TYPE="text" NAME="contact" value=<% Response.Write rsJoin("description")%>> </TD> </TR> <TR> <TD>Urgency</TD> <TD><INPUT TYPE="text" NAME="urgency" value=<% Response.Write rsJoin("urgency")%>></TD> </TR> <TR> <TD>Problem Description</TD> <TD><INPUT TYPE="text" NAME="description" value=<% Response.Write rsJoin("probdescription")%>></TD> </TR> <TR> <TD>Problem Resloution</TD> <TD><INPUT TYPE="text" NAME="probdescription" value=<% Response.Write rsJoin("probresolution")%>></TD> </TR> <td> <INPUT TYPE="submit" value=save> </form> <% 'close record set and flush object from memory rsJoin.Close set rsJoin = Nothing %> </TABLE> </BODY> </HTML> |
|
#2
|
||||
|
||||
|
I do not believe you can do an update across multiple tables at the same time.
|
|
#3
|
|||
|
|||
|
You would have to run two updates.
One for each table.
__________________
How can I soar like an eagle when I'm flying with turkey's? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Updating records with a join |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|