Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Insert using Javascript into Oracle database

Status
Not open for further replies.

kophjager

Technical User
Oct 24, 2002
31
0
0
US
Hello All,
I need some help. I seem to have hit a stone wall. I need to do a multiple insert statement into an Oracle database using javascript in my pages. I was trying to do it all one page if possible. What I am doing is pulling in up to three seperate recordsets into hidden fields on a page. Sort of a confirmation page. I then want to add all three recordsets to the same table in my database. Is there an easy to understand way to do this. I am a newbie. Also if I have to go page by page on my insert, can I insert a recordset on a page that is hidden without pressing a submit button. Basically doing it automatically from page to page. Thank you all.
 
Not sure of the exact jscript syntax but what you require is a "for each" loop in a function that is called on the forms submit

For Each RecordsetVariable

Insert into table etc

Next

Cheech The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Thanks Cheech. I am working on developing something, it is just the dreamwevaer variables that confuse me. Also it makes no difference to me if I do all the inserts at once or go from page to page and do an insert and just show a Processing image or such, but if I were to go page to page, is there a way to insert the hidden form fields automatically with no need for a submit button and just jump to the next page. Thanks.
 
yes, asp code will just get on with its stuff IF NOTHING HAS BEEN WRITTEN TO THE BROWSER. Will probably need a bit of handcoding to get it to work but it is easily done.

So no
Code:
<html> tags or Response.Write statements etc..

For example I have the following code as an update page. You will need to edit the variables to match your own.
Code:
<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<!--#include file=&quot;Connections/connYourConnectionFile.asp&quot; -->
<%
strID = Request.Querystring(&quot;id&quot;)
strUpdate = Request.Querystring(&quot;YourUpdateData&quot;)
%>

<%
set rsYourRecordset = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsYourRecordset.ActiveConnection = MM_connMeetings_STRING
rsYourRecordset.Source = &quot;SELECT * FROM tblYourTable WHERE YourUniqueID = &quot; & strID
rsYourRecordset.CursorType = 0
rsYourRecordset.CursorLocation = 2
rsYourRecordset.LockType = 3
rsYourRecordset.Open()
rsYourRecordset_numRows = 0
'declare the fields to be updated below here
rsYourRecordset(&quot;YourFirstField&quot;) = strUpdate
rsYourRecordset.Update
rsYourRecordset.Close()
strRedirect = (&quot;YourNextPage.asp&quot;)
Response.Redirect(strRedirect)
%>

Cheech The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
oops forgot the title of the page &quot;Javascript&quot; !! the above is a vbscript example but I am sure it would convert to JS.

Cheech The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top