Forums
This topic is locked
Update 2 tables from one form
Posted 14 May 2004 23:48:45
1
has voted
14 May 2004 23:48:45 Greg LeBreck posted:
I have an ASP Page that has a form for data from a MSSQL Dbase. I want to update NOT insert into 2 tables which have a related filed. Is there a Extension for DW that would help me do this. Replies
Replied 15 May 2004 00:30:17
15 May 2004 00:30:17 Vince Baker replied:
HI,
You will need to send your form data onto a process page that has hand coded update commands. This way, you can insert (or update) as many tables as you need. I have posted a dummy update command below that you can use. Just change the table and field names and dont forget to add your connection include at the top of the page and change the connection name in the command. Post back if you have any problems.
<%
Dim Update1
Dim strSQL
strSQL = "UPDATE table_name set text_field=''" & text_variable & "'', numeric_field_name=" & numeric_variable & "where unique_id_field=" & variable_id
%>
<%
set Update1 = Server.CreateObject("ADODB.Connection"
Update1.ConnectionString = MM_Connectionname_STRING
Update1.Open
Update1.Execute strSQL
Update1.Close
Set Update1 = Nothing
%>
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
You will need to send your form data onto a process page that has hand coded update commands. This way, you can insert (or update) as many tables as you need. I have posted a dummy update command below that you can use. Just change the table and field names and dont forget to add your connection include at the top of the page and change the connection name in the command. Post back if you have any problems.
<%
Dim Update1
Dim strSQL
strSQL = "UPDATE table_name set text_field=''" & text_variable & "'', numeric_field_name=" & numeric_variable & "where unique_id_field=" & variable_id
%>
<%
set Update1 = Server.CreateObject("ADODB.Connection"

Update1.ConnectionString = MM_Connectionname_STRING
Update1.Open
Update1.Execute strSQL
Update1.Close
Set Update1 = Nothing
%>
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting