OracleDataAdapter.Requery
I'm trying to avoid soft parses when I reexecute a piece of SQL. The Requery parameter on OracleDataAdapter seems to be what I want, but I can't get it to work. Can anyone advise me as to exactly what the Requery parameter is used for. Some sample code would be great.
The docs say of requery:
This property determines whether the SelectCommand is reexecuted on the next
call to Fill.
My example code looks like this. The connection used is created once then the code below is executed many times.
DataSet ds = new DataSet();
string sql="SELECT A,B FROM mytable WHERE ID= :1";
OracleCommand cmd = new OracleCommand( sql, connection );
cmd.Parameters.Add( "ID", OracleDbType.Decimal ).Value = theID;
OracleDataAdapter dataAdapter = new OracleDataAdapter();
dataAdapter.SelectCommand = cmd;
dataAdapter.Requery = false;
dataAdapter.Fill( ds, "Assets" );
sqltrace shows for this SQL:
call count
Parse 250
Execute 250
Fetch 250
total 750
I would have expected if the "selectcommand was not being reexecuted then parses would be 1, i.e. I have achieved my goal of eliminating soft parses.
thanks
Dale
Requery feature is not meant to reduce the number of soft parses. This feature is designed to reduce the number of roundtrips if the data is being fetched for a specific range of rows.
For example, if a table has 20 rows, and you fill the dataset in steps for 1 to 10 rows and then 11 to 20 rows, SQL statement is executed twice as per ADO.NET spec. By setting Requery to false, you avoid the second roundtrip as the second set of rows are fetched from the same cursor.
Similar Messages
-
Requerying a report after an insert button is presses on a form
We have created an On-line Registration system using Portal. A student runs a report displaying courses from which they can register from to add to their profile.
We would like to have the report requeryed after the client has clicked on the insert button on the form (that was called from the report).
Otherwise the student stays at the insert screen and need to use the browser back button. Does any one have a suggestion or example which they wouldn't mind sharing to help us overcome this problem.
Thanks PaulPaul,
You may want to search the Oracle9iAS Portal Applications forum for an answer to your question, but to give you a pointer.
In your form, you have a textbox called "Upon Successfull Submission" .. you would call your report here. Most likely using a redirect procedure or just calling it directly.
You will definitely be able to get more information from the other discussuion forum though.
Sue -
Requerying on Master Detail form
Hi,
Does anyone know how to set up PL/SQL code to automatically requery on a master detail form after insert/update? For example, if I insert a record on the master part of the form, I would like that record to automatically show up after the insert/update. Also, if I insert a record on the detail part of the form, I would like that record to automatically show up after an insert/update.
Thanks,
MartinHi Krishnamurthy,
Thank you very much for the code. The code for the most part acts like I want it to except when I initally insert a master record. In my case, I have the form set up so you have to insert a master record before you can insert any detail records. Therefore, after the user clicks save, that master record needs to come up. The code you gave me only brings up the current master record if you are inserting detail records (which is great, that is what I want it to do). I have modified the code you gave me so when a user is just inserting the master record, the master record automaticaly comes up rather than the first record in the table. However my code makes the form run slow (about 13 seconds to save). Do you know of another way that I can make the form act like I want it to. Below is my code.
Thanks again,
Martin
declare
l_msg varchar2(255);
l_key_value number(10);
l_key_value2 number(10);
v_get_id number(9);
v_check_detail number(9);
CURSOR GET_ID IS
SELECT MAX(A.PCH_ID)
FROM PORTAL30.PCHEADER A;
CURSOR CHECK_DETAILS IS
SELECT DISTINCT B.PCD_ID
FROM PORTAL30.PCDETAILS B WHERE B.PCD_PHC_ID = v_get_id;
begin
/*get the key field value from the Master Detail form to requery the details since the form will be cleared out after update */
l_key_value := p_session.get_value_as_NUMBER(
p_block_name => 'MASTER_BLOCK',
p_attribute_name => 'A_PCH_ID',
p_index => 1
doSave;--- This is the default handler
OPEN get_id;
FETCH get_id into v_get_id;
CLOSE get_id;
OPEN check_details;
FETCH check_details into v_check_detail;
IF check_details%NOTFOUND
THEN
CLOSE check_details;
/*get the key field value from the Master Detail form to requery the details since the form will
be cleared out after update */
l_key_value2 := v_get_id;
/*get the message which is going to be displayed after update */
l_msg := p_session.get_value_as_varchar2(
p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_STATUS');
/*now set the key field value in the Master Detail */
p_session.set_shadow_value(p_block_name => 'MASTER_BLOCK',
p_attribute_name => 'A_PCH_ID',
p_value => l_key_value2,
p_language => PORTAL30.wwctx_api.get_nls_language);
WWV_MASTER_GENSYS_1(p_block_name => null,
p_object_name => null,
p_instance => null,
p_event_type => null,
p_user_args => null,
p_session => p_session);
/*put the message(like 'Updated one master record' ) back in the screen */
p_session.set_value(p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_STATUS',
p_value => l_msg);
p_session.set_value
(p_block_name => 'MASTER_BLOCK'
,p_attribute_name => '_MASTER_ACTION'
,p_value => 'NONE');
p_session.save_session();
ELSE
CLOSE check_details;
/*get the message which is going to be displayed after update*/
l_msg := p_session.get_value_as_varchar2(
p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_STATUS');
/*now set the key field value in the Master Detail*/
p_session.set_shadow_value(p_block_name => 'MASTER_BLOCK',
p_attribute_name => 'A_PCH_ID',
p_value => l_key_value,
p_language => PORTAL30.wwctx_api.get_nls_language);
WWV_MASTER_GENSYS_1(p_block_name => null,
p_object_name => null,
p_instance => null,
p_event_type => null,
p_user_args => null,
p_session => p_session);
/*put the message(like 'Updated one master record' ) back in the screen*/
p_session.set_value(p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_STATUS',
p_value => l_msg);
p_session.save_session();
END IF;
END; -
How can I get a detail block to requery after a database change?
Hi, I have a master/detail form. When the status of the master record changes, I need to update a date in one of the detail records. If I use SQL to update the detail row in the database in the ON-CHANGE trigger of the master block, how can I get the detail block to requery to show the change? When I try doing a go_block from any of the ...UPDATE triggers, it says it is restricted.
wjpenfold,
Do you have a "Relationship" defined between your Master and Detail blocks? If so, you simply need to requery your master block and the detail block will automatically be requeried. If you can't use a relationship, then you can use can create a timer in the trigger that updates the database and then in the When-Timer-Expired (WTE) trigger you can go to the detail block and execute a query. For example:
/* Sample On-Change trigger */
DECLARE
timer_id TIMER;
BEGIN
....your code here that performs the update....
/* Now create an instance of a timer */
timer_id := Create_Timer ('upd_detail',1,NO_REPEAT);
END;
/* Sample Form Level When-Timer-Expired trigger */
DECLARE
timer_id TIMER;
BEGIN
-- Find the timer first
timer_id := FIND_TIMER('upd_detail');
IF NOT ID_NULL(timer_id) THEN
GO_BLOCK('DETAIL_BLOCK');
Execute_Query;
END IF;
END;Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
I have another issue with my summary/update processing. I have a form where members can list themselves for either needing or wanting boat/crew/housing. Below the form is a listing of all associated requests:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/ilcaData.asp" -->
<!--#include file="../../Connections/eventCalendar.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "needavailadd") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
MM_editCmd.CommandText = "INSERT INTO needAvail (naType, memName, city, [state], phone, email, info, eventID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 3, Request.Form("naType")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 32, Request.Form("memName")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 18, Request.Form("city")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 2, Request.Form("state")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 12, Request.Form("phone")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 48, Request.Form("email")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 75, Request.Form("info")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 5, 1, -1, MM_IIF(Request.Form("eventID"), Request.Form("eventID"), null)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "eventneedavail.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim rsStates
Dim rsStates_cmd
Dim rsStates_numRows
Set rsStates_cmd = Server.CreateObject ("ADODB.Command")
rsStates_cmd.ActiveConnection = MM_ilcaData_STRING
rsStates_cmd.CommandText = "SELECT * FROM stateCodes"
rsStates_cmd.Prepared = true
Set rsStates = rsStates_cmd.Execute
rsStates_numRows = 0
%>
<%
Dim rsneedavailReq
Dim rsneedavailReq_cmd
Dim rsneedavailReq_numRows
Set rsneedavailReq_cmd = Server.CreateObject ("ADODB.Command")
rsneedavailReq_cmd.ActiveConnection = MM_eventCalendar_STRING
rsneedavailReq_cmd.CommandText = "SELECT * FROM needAvailReq"
rsneedavailReq_cmd.Prepared = true
Set rsneedavailReq = rsneedavailReq_cmd.Execute
rsneedavailReq_numRows = 0
%>
<%
Dim rsneedAvail__MMColParam
rsneedAvail__MMColParam = "0"
If (Request.Querystring("ID") <> "") Then
rsneedAvail__MMColParam = Request.Querystring("ID")
End If
%>
<%
Dim rsneedAvail
Dim rsneedAvail_cmd
Dim rsneedAvail_numRows
Set rsneedAvail_cmd = Server.CreateObject ("ADODB.Command")
rsneedAvail_cmd.ActiveConnection = MM_eventCalendar_STRING
rsneedAvail_cmd.CommandText = "SELECT * FROM eventneedAvail WHERE eventID = ?"
rsneedAvail_cmd.Prepared = true
rsneedAvail_cmd.Parameters.Append rsneedAvail_cmd.CreateParameter("param1", 5, 1, -1, rsneedAvail__MMColParam) ' adDouble
Set rsneedAvail = rsneedAvail_cmd.Execute
rsneedAvail_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsneedAvail_numRows = rsneedAvail_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- InstanceBegin template="/Templates/mainLayout.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Welcome to the International Lightning Class</title>
<meta name="Keywords" content="Lightning, lightning sailboat, lightning class, international lightning class, lightning class sailboat, lightning class association" />
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="../../assets/favicon.ico" rel="shortcut icon" />
<link href="../../css/mainLayout2.css" rel="stylesheet" type="text/css" />
<link href="../../css/navMenu.css" rel="stylesheet" type="text/css" />
<link href="../../css/ilcaStyles.css" rel="stylesheet" type="text/css" />
<link href="../../css/document.css" rel="stylesheet" type="text/css" />
<script src="../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<!-- InstanceBeginEditable name="styles" -->
<link href="../../css/needAvail.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
//-->
</script>
<!-- InstanceEndEditable -->
<!-- InstanceParam name="setdatetype" type="text" value="" -->
<!-- InstanceParam name="cleanup" type="text" value="" -->
</head>
<body onload="" onunload="">
<%
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "on") Then
Dim xredir__, xqstr__
xredir__ = "http://" & Request.ServerVariables("SERVER_NAME") & _
Request.ServerVariables("SCRIPT_NAME")
xqstr__ = Request.ServerVariables("QUERY_STRING")
if xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__
Response.redirect xredir__
End if
%>
<div id="wrapper">
<div id="header">
<div id="hdrLink"><a href="../../index.asp"><img src="../../assets/images/mainTemplate/headerImg.png" width="839" height="183" border="0" /></a></div>
</div>
<div id="sidebar">
<div id="navigation">
<!-- menu script itself. you should not modify this file -->
<script type="text/javascript" language="JavaScript" src="../../scripts/navMenu.js"></script>
<!-- items structure. menu hierarchy and links are stored there -->
<script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_items.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_items.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_items.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_items.js"></script>
<!-- files with geometry and styles structures -->
<script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_tpl2.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_tpl.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_tpl.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_tpl.js"></script>
<script type="text/javascript" language="javascript">
<!--//
// Make sure the menu initialization is right above the closing </body> tag
// Moving it inside other tags will not affect the position of the menu on
// the page. If you need this feature please consider Tigra Menu GOLD.
// each menu gets two parameters (see demo files)
// 1. items structure
// 2. geometry structure
new menu (MENU_ITEMS, MENU_TPL);
// If you don't see the menu then check JavaScript console of the browser for the error messages
// "Variable is not defined" error indicates that there's syntax error in that variable's definition
// or the file with that variable isn't properly linked to the HTML document
//-->
</script>
</div>
<div id="sbar-image3"> <a href="http://www.facebook.com/pages/International-Lightning-Class-Association/197584991571" target="_blank"><img src="../../assets/images/mainTemplate/facebook.png" alt="Facebook ILCA link" width="36" height="36" border="0" /></a> <a href="http://twitter.com/IntLightning" target="_blank"><img src="../../assets/images/mainTemplate/twitter.png" alt="Twitter ILCA link" width="36" height="36" border="0" /></a> Connect with us</span></span></span> <br />
</div>
<div id="sbarSearch">
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<TABLE width="126" align="center" bgcolor="#FFFFFF">
<tr>
<td width="135"><img src="../../assets/images/mainTemplate/google.jpg" width="68" height="21" alt="Google logo" /></td>
</tr>
<tr>
<td><input type=text name=q size=20 maxlength=255 value="" />
<input type=submit name=btnG value="Google Search" />
<font size=-2>
<input type=hidden name=domains value="www.lightningclass.org">
<br>
<input type=radio
name=sitesearch value="">
Web
<input type=radio name=sitesearch value="www.lightningclass.org" checked>
Site<br>
</font></td>
</tr>
</TABLE>
</FORM>
<!-- SiteSearch Google -->
</div>
<div id="sbarTranslate">
<script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up _source_language=en&w=148&h=60&title=&border=&output=js"></script>
</div>
<div id="sbar-image1"><a href="http://www.guadalajara2011.org.mx/esp/01_inicio/index.asp"><img src="../../assets/images/mainTemplate/panAm.jpg" width="116" height="129" border="0" /></a></div>
<div id="sbar-image2"><a href="../../membership/joinRenew/membershipOptions.asp"><img src="../../assets/images/mainTemplate/joinILCA.png" alt="Join the ILCA" width="113" height="113" border="0" /></a></div>
</div>
<div id="background">
<div id="mainContent"> <!-- InstanceBeginEditable name="mainContent" -->
<div id="docHdr"> Header </div>
<div id="docBody">
<div id="listMe">
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="needavailadd">
<fieldset id="needavailAdd" name="needavailAdd">
<legend class="legend">Logistics-Add</legend>
<br />
<label for="naType">Request Type:</label>
<label>
<select name="naType" size="1" id="naType" tabindex="1">
<option value="Sel" <%If (Not isNull(" Select a request type")) Then If ("Sel" = CStr(" Select a request type")) Then Response.Write("selected=""selected""") : Response.Write("")%>> Select a request type</option>
<%
While (NOT rsneedavailReq.EOF)
%>
<option value="<%=(rsneedavailReq.Fields.Item("requestKey").Value)%>" <%If (Not isNull(" Select a request type")) Then If (CStr(rsneedavailReq.Fields.Item("requestKey").Value) = CStr(" Select a request type")) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsneedavailReq.Fields.Item("requestType").Value)%></option>
<%
rsneedavailReq.MoveNext()
Wend
If (rsneedavailReq.CursorType > 0) Then
rsneedavailReq.MoveFirst
Else
rsneedavailReq.Requery
End If
%>
</select>
</label>
<br />
<br />
<label>First and Last Name:
<input name="memName" type="text" id="memName" tabindex="2" onblur="MM_validateForm('memName','','R');return document.MM_returnValue" />
</label>
<br />
<br />
<label>City:
<input name="city" type="text" id="city" tabindex="3" onblur="MM_validateForm('city','','R');return document.MM_returnValue" />
</label>
<label>State: </label>
<label>
<select name="state" size="1" id="state" tabindex="4" onchange="MM_validateForm('phone','','NisNum');MM_validateForm('email','','NisEmail');ret urn document.MM_returnValue">
<option value="Sel" <%If (Not isNull(" Select a state")) Then If ("Sel" = CStr(" Select a state")) Then Response.Write("selected=""selected""") : Response.Write("")%>> Select a state</option>
<%
While (NOT rsStates.EOF)
%>
<option value="<%=(rsStates.Fields.Item("stateCode").Value)%>" <%If (Not isNull(" Select a state")) Then If (CStr(rsStates.Fields.Item("stateCode").Value) = CStr(" Select a state")) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsStates.Fields.Item("stateName").Value)%></option>
<%
rsStates.MoveNext()
Wend
If (rsStates.CursorType > 0) Then
rsStates.MoveFirst
Else
rsStates.Requery
End If
%>
</select>
</label>
<br />
<br />
<label>Telephone#:
<input type="text" name="phone" id="phone" tabindex="5" />
</label>
<br />
<br />
<label>Email:
<input name="email" type="text" id="email" tabindex="6" size="48" maxlength="48" />
</label>
<br />
<br />
<label>Additional Information:
<input name="info" type="text" id="info" tabindex="7" size="58" maxlength="255" />
</label>
<br />
<br />
<input type="submit" name="addButton" id="addButton" value="Add Me" tabindex="8" />
<input type="reset" name="reset" id="reset" value="Reset" />
</fieldset>
<input name="eventID" type="hidden" id="eventID" value="<%=Request.QueryString("ID")%>" />
<input type="hidden" name="MM_insert" value="needavailadd" />
</form>
</div>
<div id="nameList">
<table width=640 align=left>
<% if rsneedAvail.EOF then
response.write "<strong>No Requests Yet</strong>"
else
response.write "<strong>" & (rsneedAvail_total) & "</strong>"
response.write "<strong> Logistics Requests:</strong>"%>
<p align="left"> </p>
<% icat = rsneedAvail.Fields.Item("requestType").Value %>
<tr>
<td colspan='2' class="eventMonths"><%=(rsneedAvail.Fields.Item("requestType").Value)%></td>
</tr>
<tr>
<td colspan='2'><hr width=250% align="center"/></td>
</tr>
<%rsneedAvail.Requery%>
<% While ((Repeat1__numRows <> 0) AND (NOT rsneedAvail.EOF)) %>
<% If rsneedAvail.Fields.Item("requestType").Value <> icat then
icat = rsneedAvail.Fields.Item("requestType").Value%>
<tr height="20">
<td colspan='2'></td>
</tr>
<tr>
<td colspan='2' class="eventMonths"><%=(rsneedAvail.Fields.Item("requestType").Value)%></td>
</tr>
<tr>
<td colspan='2'><hr width=250% align="center"/></td>
</tr>
<%End If %>
<tr>
<td width="165"><%=(rsneedAvail.Fields.Item("name").Value)%></td>
<td width="150"><%=(rsneedAvail.Fields.Item("location").Value)%></td>
<td width="100"><%=(rsneedAvail.Fields.Item("phone").Value)%></td>
<td width="265"><%=(rsneedAvail.Fields.Item("info").Value)%></td>
<td width="30" class="hpResults" aligm="left"><div align="center"><a href="eventneedavailUpdate.asp?ID=<%=(rsneedAvail.Fields.Item("recID").Value)%>"><span class="eventeditLink">Edit</span></a></div></td>
<td width="30" class="hpResults" aligm="left"><div align="center"><a href="eventupdateLogin.asp?ID=<%=(rsneedAvail.Fields.Item("recID").Value)%>"><span class="eventeditLink">Delete</span></a></div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsneedAvail.MoveNext()
Wend
end if
%>
</table>
</div>
</div>
<!-- InstanceEndEditable --></div>
</div>
<div id="clear"></div>
<div id="footer">
<p><u><a href="../../membership/joinRenew/membershipOptions.asp" class="ftrLinks">Membership</a></u> | <u><a href="eventSelect.asp" class="ftrLinks">Racing</a></u> | <u><a href="../../classRules/documents/ilcaBylaws.asp" class="ftrLinks">Class Rules</a></u> | <u><a href="../../photoGallery/photos2008/index.asp" class="ftrLinks">Photo Gallery</a></u> | <u class="ftrLinks"><a href="../../marketplace/store/index.asp">Marketplace</a></u> | <u><a href="../../contacts/index.asp" class="ftrLinks">Contacts</a></u> | <u class="ftrLinks"><a href="../../siteMap.asp">Site Map</a></u><br />
All Rights Reserved—International Lightning Class Association<br />
<u><a href="mailto:[email protected]" class="ftrLinks">[email protected]</a></u><br />
1528 Big Bass Drive, Tarpon Springs, Florida 34689— Phone: 727-942-7969 — Fax: 727-942-0173 — Skype: ilcaoffice</p>
</div>
</div>
</body>
<!-- InstanceEnd -->
</html>
<%
rsStates.Close()
Set rsStates = Nothing
%>
<%
rsneedavailReq.Close()
Set rsneedavailReq = Nothing
%>
<%
rsneedAvail.Close()
Set rsneedAvail = Nothing
%>
Entries may be updated. After the update, the page above is displayed. Sometimes the updated information displays, but more often it does not (????). I have tried a requery, but that is not working. How do I requery the recordset so that the current information always displays?
Update page:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/ilcaData.asp" -->
<!--#include file="../../Connections/eventCalendar.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_update")) = "needavailUpdate") Then
If (Not MM_abortEdit) Then
' execute the update
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
MM_editCmd.CommandText = "UPDATE needAvail SET naType = ?, memName = ?, city = ?, [state] = ?, phone = ?, email = ?, info = ? WHERE recID = ?"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 3, Request.Form("naType")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 32, Request.Form("memName")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 18, Request.Form("city")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 2, Request.Form("state")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 12, Request.Form("phone")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 48, Request.Form("email")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 75, Request.Form("info")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "eventneedavail.asp?ID=" & Request.Form("eventID")
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl
Else
MM_editRedirectUrl = MM_editRedirectUrl
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim rsStates
Dim rsStates_cmd
Dim rsStates_numRows
Set rsStates_cmd = Server.CreateObject ("ADODB.Command")
rsStates_cmd.ActiveConnection = MM_ilcaData_STRING
rsStates_cmd.CommandText = "SELECT * FROM stateCodes"
rsStates_cmd.Prepared = true
Set rsStates = rsStates_cmd.Execute
rsStates_numRows = 0
%>
<%
Dim rsneedavailReq
Dim rsneedavailReq_cmd
Dim rsneedavailReq_numRows
Set rsneedavailReq_cmd = Server.CreateObject ("ADODB.Command")
rsneedavailReq_cmd.ActiveConnection = MM_eventCalendar_STRING
rsneedavailReq_cmd.CommandText = "SELECT * FROM needavailReq"
rsneedavailReq_cmd.Prepared = true
Set rsneedavailReq = rsneedavailReq_cmd.Execute
rsneedavailReq_numRows = 0
%>
<%
Dim rsneedAvail__MMColParam
rsneedAvail__MMColParam = "0"
If (Request.QueryString("ID") <> "") Then
rsneedAvail__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim rsneedAvail
Dim rsneedAvail_cmd
Dim rsneedAvail_numRows
Set rsneedAvail_cmd = Server.CreateObject ("ADODB.Command")
rsneedAvail_cmd.ActiveConnection = MM_eventCalendar_STRING
rsneedAvail_cmd.CommandText = "SELECT * FROM needAvail WHERE recID = ?"
rsneedAvail_cmd.Prepared = true
rsneedAvail_cmd.Parameters.Append rsneedAvail_cmd.CreateParameter("param1", 5, 1, -1, rsneedAvail__MMColParam) ' adDouble
Set rsneedAvail = rsneedAvail_cmd.Execute
rsneedAvail_numRows = 0
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/mainLayout.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Welcome to the International Lightning Class</title>
<meta name="Keywords" content="Lightning, lightning sailboat, lightning class, international lightning class, lightning class sailboat, lightning class association" />
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="../../assets/favicon.ico" rel="shortcut icon" />
<link href="../../css/mainLayout2.css" rel="stylesheet" type="text/css" />
<link href="../../css/navMenu.css" rel="stylesheet" type="text/css" />
<link href="../../css/ilcaStyles.css" rel="stylesheet" type="text/css" />
<link href="../../css/document.css" rel="stylesheet" type="text/css" />
<script src="../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<!-- InstanceBeginEditable name="styles" -->
<link href="../../css/needAvail.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
<!-- InstanceParam name="setdatetype" type="text" value="" -->
<!-- InstanceParam name="cleanup" type="text" value="" -->
</head>
<body onload="" onunload="">
<%
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "on") Then
Dim xredir__, xqstr__
xredir__ = "http://" & Request.ServerVariables("SERVER_NAME") & _
Request.ServerVariables("SCRIPT_NAME")
xqstr__ = Request.ServerVariables("QUERY_STRING")
if xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__
Response.redirect xredir__
End if
%>
<div id="wrapper">
<div id="header">
<div id="hdrLink"><a href="../../index.asp"><img src="../../assets/images/mainTemplate/headerImg.png" width="839" height="183" border="0" /></a></div>
</div>
<div id="sidebar">
<div id="navigation">
<!-- menu script itself. you should not modify this file -->
<script type="text/javascript" language="JavaScript" src="../../scripts/navMenu.js"></script>
<!-- items structure. menu hierarchy and links are stored there -->
<script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_items.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_items.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_items.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_items.js"></script>
<!-- files with geometry and styles structures -->
<script type="text/javascript" language="JavaScript" src="../../scripts/navMenu_tpl2.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu_tpl.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/boatgrantMenu2_tpl.js"></script>
<script type="text/javascript" language="JavaScript" src="../../scripts/storeMenu_tpl.js"></script>
<script type="text/javascript" language="javascript">
<!--//
// Make sure the menu initialization is right above the closing </body> tag
// Moving it inside other tags will not affect the position of the menu on
// the page. If you need this feature please consider Tigra Menu GOLD.
// each menu gets two parameters (see demo files)
// 1. items structure
// 2. geometry structure
new menu (MENU_ITEMS, MENU_TPL);
// If you don't see the menu then check JavaScript console of the browser for the error messages
// "Variable is not defined" error indicates that there's syntax error in that variable's definition
// or the file with that variable isn't properly linked to the HTML document
//-->
</script>
</div>
<div id="sbar-image3"> <a href="http://www.facebook.com/pages/International-Lightning-Class-Association/197584991571" target="_blank"><img src="../../assets/images/mainTemplate/facebook.png" alt="Facebook ILCA link" width="36" height="36" border="0" /></a> <a href="http://twitter.com/IntLightning" target="_blank"><img src="../../assets/images/mainTemplate/twitter.png" alt="Twitter ILCA link" width="36" height="36" border="0" /></a>
Connect with us</span></span></span>
<br />
</div>
<div id="sbarSearch">
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<TABLE width="126" align="center" bgcolor="#FFFFFF"><tr><td width="135"><img src="../../assets/images/mainTemplate/google.jpg" width="68" height="21" alt="Google logo" />
</td></tr>
<tr>
<td><input type=text name=q size=20 maxlength=255 value="" />
<input type=submit name=btnG value="Google Search" />
<font size=-2>
<input type=hidden name=domains value="www.lightningclass.org"><br><input type=radio
name=sitesearch value=""> Web
<input type=radio name=sitesearch value="www.lightningclass.org" checked>
Site<br>
</font>
</td></tr></TABLE>
</FORM>
<!-- SiteSearch Google -->
</div>
<div id="sbarTranslate">
<script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up _source_language=en&w=148&h=60&title=&border=&output=js"></script>
</div>
<div id="sbar-image1"><a href="http://www.guadalajara2011.org.mx/esp/01_inicio/index.asp"><img src="../../assets/images/mainTemplate/panAm.jpg" width="116" height="129" border="0" /></a></div>
<div id="sbar-image2"><a href="../../membership/joinRenew/membershipOptions.asp"><img src="../../assets/images/mainTemplate/joinILCA.png" alt="Join the ILCA" width="113" height="113" border="0" /></a></div>
</div>
<div id="background">
<div id="mainContent"> <!-- InstanceBeginEditable name="mainContent" -->
<div id="docHdr"> Header </div>
<div id="docBody">
<div id="listMe">
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="needavailUpdate">
<fieldset id="needavailUpdate" name="needavailUpdate">
<legend class="legend">Need/Available</legend>
<br />
<label for="naType">Request Type:</label>
<label>
<select name="naType" id="naType" tabindex="1">
<option value="" <%If (Not isNull((rsneedAvail.Fields.Item("naType").Value))) Then If ("" = CStr((rsneedAvail.Fields.Item("naType").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>></option>
<%
While (NOT rsneedavailReq.EOF)
%>
<option value="<%=(rsneedavailReq.Fields.Item("requestKey").Value)%>" <%If (Not isNull((rsneedAvail.Fields.Item("naType").Value))) Then If (CStr(rsneedavailReq.Fields.Item("requestKey").Value) = CStr((rsneedAvail.Fields.Item("naType").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsneedavailReq.Fields.Item("requestType").Value)%></option>
<%
rsneedavailReq.MoveNext()
Wend
If (rsneedavailReq.CursorType > 0) Then
rsneedavailReq.MoveFirst
Else
rsneedavailReq.Requery
End If
%>
</select>
</label>
<br />
<br />
<label>First and Last Name:
<input name="memName" type="text" id="memName" tabindex="2" value="<%=(rsneedAvail.Fields.Item("memName").Value)%>" />
</label>
<br />
<br />
<label>City:
<input name="city" type="text" id="city" tabindex="3" value="<%=(rsneedAvail.Fields.Item("city").Value)%>" />
</label>
<label>State: </label>
<label>
<select name="state" id="state" tabindex="4">
<option value="" <%If (Not isNull((rsneedAvail.Fields.Item("state").Value))) Then If ("" = CStr((rsneedAvail.Fields.Item("state").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>></option>
<%
While (NOT rsStates.EOF)
%>
<option value="<%=(rsStates.Fields.Item("stateCode").Value)%>" <%If (Not isNull((rsneedAvail.Fields.Item("state").Value))) Then If (CStr(rsStates.Fields.Item("stateCode").Value) = CStr((rsneedAvail.Fields.Item("state").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsStates.Fields.Item("stateName").Value)%></option>
<%
rsStates.MoveNext()
Wend
If (rsStates.CursorType > 0) Then
rsStates.MoveFirst
Else
rsStates.Requery
End If
%>
</select>
</label>
<br />
<br />
<label>Telephone#:
<input name="phone" type="text" id="phone" tabindex="5" value="<%=(rsneedAvail.Fields.Item("phone").Value)%>" />
</label>
<br />
<br />
<label>Email:
<input name="email" type="text" id="email" tabindex="6" value="<%=(rsneedAvail.Fields.Item("email").Value)%>" size="48" maxlength="48" />
</label>
<br />
<br />
<label>Additional Information:
<input name="info" type="text" id="info" tabindex="7" value="<%=(rsneedAvail.Fields.Item("info").Value)%>" size="58" maxlength="255" />
</label>
<br />
<br />
<input type="submit" name="addButton" id="addButton" value="Update Me" tabindex="5" />
<input type="reset" name="reset" id="reset" value="Reset" />
</fieldset>
<input type="hidden" name="MM_update" value="needavailUpdate" />
<input type="hidden" name="MM_recordId" value="<%= rsneedAvail.Fields.Item("recID").Value %>" />
<input type="hidden" name="eventID" value="<%= rsneedAvail.Fields.Item("eventID").Value %>" />
</form>
</div>
</div>
<!-- InstanceEndEditable --></div>
</div>
<div id="clear"></div>
<div id="footer">
<p><u><a href="../../membership/joinRenew/membershipOptions.asp" class="ftrLinks">Membership</a></u> | <u><a href="eventSelect.asp" class="ftrLinks">Racing</a></u> | <u><a href="../../classRules/documents/ilcaBylaws.asp" class="ftrLinks">Class Rules</a></u> | <u><a href="../../photoGallery/photos2008/index.asp" class="ftrLinks">Photo Gallery</a></u> | <u class="ftrLinks"><a href="../../marketplace/store/index.asp">Marketplace</a></u> | <u><a href="../../contacts/index.asp" class="ftrLinks">Contacts</a></u> | <u class="ftrLinks"><a href="../../siteMap.asp">Site Map</a></u><br />
All Rights Reserved—International Lightning Class Association<br />
<u><a href="mailto:[email protected]" class="ftrLinks">[email protected]</a></u><br />
1528 Big Bass Drive, Tarpon Springs, Florida 34689— Phone: 727-942-7969 — Fax: 727-942-0173 — Skype: ilcaoffice</p>
</div>
</div>
</body>
<!-- InstanceEnd --></html>
<%
rsStates.Close()
Set rsStates = Nothing
%>
<%
rsneedavailReq.Close()
Set rsneedavailReq = Nothing
%>
<%
rsneedAvail.Close()
Set rsneedAvail = Nothing
%>Thank you for your attention and diligence. I know it was overwhelming. I've uploaded my new pages and found that they seem to be working as designed - whereas they weren't working totally correctly on localhost. I believe I'm good for now. If I run into more problems, I'll find a simpler way to present the problem. Thank you, again.
-
Oracle Forms in R11i apps Q how to requery when called form is closed
Scenario:
I have formA. I am calling another formB from FormA. When I do update on Form B and close the control needs to come back to formA and requery (so I can see changes to the updates done in formB).
Issue:
I’m successfully launching formB (using fnd_function.execute) and able to update but when I close formB, I’m not able to requery as the control is not coming back to formA.
Which event should i use when i close the FormB so i can navigate back to called FormA and Requery. ( i tried exit_form, key-exit, the formB is only closing but unable to go to formA)
Thank you.I'm not 100% sure, but I believe ZOOM should work in your case. A slightly dated but valid explanation is here - http://download.oracle.com/docs/cd/A60725_05/html/comnls/us/fnd/zoom05.htm#codezoom
Pl see the Application Developer Guide for your release of EBS at http://www.oracle.com/technetwork/documentation/applications-167706.html
HTH
Srini -
OracleDataAdapter returning wrong number of columns
Hello All,
I have an issue of an oracle data adapter not returning all columns in my select statement. When I use code similar to below, the data adapter returns 2 columns per row instead of 5. And they are out of order (ie, DataRow(0) could be column 1 and DataRow(1) could be column 4 -- so I don't see which columns have been dropped without looking at the value).
The database id XE on the local machine. The connection works fine. And the internal VS.NET PL/SQL debugger returns the query just fine.
Some of the columns I'm trying to get are null -- in fact, most are. But they are changed during the program. So I still need them to show up in the dataset.
BTW, I have had zero success getting OracleCommand.BindByName and OracleParameters to work, so I punted. Since I can get what I want out of readers and datasets, I can live without'em -- or can I?!?!
I think my problem has something to do with handling null values. So I have tried the select statement with NVL wrapping the fields that could be null. But still no success.
Any ideas?
Table:
account char(30) not null
col_code as NUMBER(1,0) null ok
columnIDontNeed as whatever null ok
sum1 as char(1) null ok
sum2 as char(1) null ok
sum3 as char(1) null ok
anotherColumnIDontNeed as whatever null ok
Sample Code:
dim oconn as New OracleConnection(conStrBldr.toString)
Dim cmdLedger As OracleCommand = oconn.CreateCommand
cmdLedger.BindByName = True ' seems to affect nothing! ever!
cmdLedger.AddToStatementCache = False ' no noticable affect
cmdLedger.CommandText = " SELECT account,col_code,sum1,sum2,sum3 "
cmdLedger.CommandText &= "FROM gl.ledger "
cmdLedger.CommandText &= "ORDER BY gl.ledger.account "
cmdLedger.CommandType = CommandType.Text
' Create DataAdapter based on main Ledger SELECT
Dim cmdLedgerDA As New OracleDataAdapter(cmdLedger)
cmdLedgerDA.ReturnProviderSpecificTypes = True ' same results with False
' Create DataSet and Fill it.
' After this, we can now use this dataset
' to iterate through the GL ledger data.
Dim cmdLedgerDS As New DataSet("GLBal")
Try ' to fill dataset with Ledger SELECT
' fill dataset from OracleDataAdapter and the
' previously defined Oracle Command.
cmdLedgerDA.Fill(cmdLedgerDS, "GL.LEDGER") ' tried with and without src
Catch ex As OracleException
ShowEx(ex)
End Try ' to fill dataset with Ledger SELECT
These are the typical test from within VB that I've run to check what was returned:
console.writeline(cmdLedgerDS.Tables(0).Rows(0).ItemArray.Length)
2
dim row as DataRow = cmdLedgerDS.Tables(0).Rows(0)
console.writeline(row(0).toString & row(1).toString & row(2).toString & row(3).toString & row(4).toString) ' EXCEPTION IS THROWNI cannot reproduce the error using basic code below. What is the specific exception you get?
And BindByName is not necessary since you're not using bind variables
Sub Main()
Dim da As OracleDataAdapter
Dim sqlstr As String
Dim connstr As String
Dim ds As DataSet
Dim dr As DataRow
Dim dc As DataColumn
Try
sqlstr = "select employee_id, first_name, last_name, null, salary "
sqlstr &= "from employees where rownum < 10"
connstr = "Data Source=xe;User ID=hr;Password=hr;"
da = New OracleDataAdapter(sqlstr, New OracleConnection(connstr))
ds = New DataSet("EmployeeDS")
da.Fill(ds, "employees")
For Each dc In ds.Tables("employees").Columns
Console.Write(dc.ColumnName & " ")
Next
Console.WriteLine()
For Each dr In ds.Tables("employees").Rows
Console.WriteLine(dr(0).ToString & " " & _
dr(1).ToString & " " & dr(2).ToString & " " & _
dr(3).ToString & " " & dr(4).ToString)
Next
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End SubOutput should look like
EMPLOYEE_ID FIRST_NAME LAST_NAME NULL SALARY
100 Steven King 24000
101 Neena Kochhar 17000
102 Lex De Haan 17000
103 Alexander Hunold 9000
104 Bruce Ernst 6000
105 David Austin 4800
106 Valli Pataballa 4800
107 Diana Lorentz 4200
108 Nancy Greenberg 12000I am using VS2005, ODP 10.2.0.2.21 and OracleXE on remote machine.
NH
Message was edited by:
nurhidayat -
Applying a filter to an existing webi report without requerying
Hi,
I'm trying to apply a filter to a webi report using the Report Engine Java SDK. Here's a snippet of my code:
DataProviders dataProviders = doc.getDataProviders();
DataProvider dataProvider = dataProviders.getItem(0);
Query queryObj = dataProvider.getQuery();
ConditionContainer cc = queryObj.getCondition();
if (cc == null) {
cc = queryObj.createCondition(LogicalOperator.AND);
ConditionObject co = cc.createConditionObject(filterObject);
FilterCondition fc = co.createFilterCondition(Operator.EQUAL);
FilterConditionConstant fcc = fc.createFilterConditionConstant(filterValue);
dataProvider.runQuery();
But my problem with this code is that it needs to query the data provider to refresh the report. And it has to requery the data provider each time I want to apply a different filter value like in the case of report bursting. Is it possible to apply a filter to the webi report without requerying the data provider?
Many thanks to anyone who could help.HI Elijah,
I need a bit of clarification here. Are you seeing the actual query being run against the database each time, or are you referring to having to retrieve the query from the dataprovider each time?
If you are actually seeing the query being run - then that is something that should be investigated, however with regards to just retrieving the query from the dataprovider - yes you do need to do that in order to apply a filter.
Thanks
Shawn -
Oracle.DataAccess.Client.OracleDataAdapter exists in both v2 and v4
Hi there,
I am developing ASP Net application with ODP.NET 11.2.0.2.1 and VS 2010. The target framework is .Net framework 3.5 and I've explicitly Oracle.DataAccess reference to v.2, with
<add assembly="Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89B483F429C47342"/>
, but when it compiled, it throw error
The type 'Oracle.DataAccess.Client.OracleDataAdapter' exists in both
'c:\WINDOWS\assembly\GAC_32\Oracle.DataAccess\2.112.2.0__89b483f429c47342\oracle.dataaccess.dll'
and 'c:\WINDOWS\Microsoft.NET\assembly\GAC_32\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342\oracle.dataaccess.dll'
c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\esptweb\df172a69\e974c60e\App_Code.eoge0t0f.4.cs
How can I fixed it?
Thanks for the help.Did you try adding that reference using the Add Reference command in Visual Studio instead? I've never seen it behave like this before.
There are two versions of the assembly, but it shouldn't be trying to load the .net 4 version if you have a reference to the .net 2 version and you're in a 2 (or 3.5) app. -
Oracle.DataAccess.Client.OracleDataAdapter.Update not working
Hi
I am using the Oracle.DataAccess.Client.OracleDataAdapter from Oracle.DataAccess runtime version v4.0.30319. I set the SelectCommand and retrieve data from Oracle without any problems using the adapter to fill a datatable. I then use the DataTable.Clear method to remove all rows and fill it again from a different source using a different adapter. I use the Oracle.DataAccess.Client.OracleCommandBuilder to create the Insert and Update commands and finally I call the update command of the using the original adapter in order to update the Oracle database but nothing is updated.
I examine the table row count at each stage and also display the table using a DataGridView on a form and all appears to be fine. No exception is thrown so I am stumped.
I would be grateful for any suggestions as to what I am doing wrong.
My environment is VS2010 Express
Edited by: user1947494 on 04-Feb-2011 05:46Hi,
Pretty tough without seeing any code. I really do not believe it has anything to do with the DataAdapter. What changed the specific row/rows after the second fill?
But, as a guess, take a look at the DataTable - Rows - RowState. Run the below(or some variant) method just prior to your update.
r,
dennis
public static DataTable GetDataTableChanges_Modified(DataSet dataSet, string dataTableName)
if (dataSet.Tables[dataTableName].Rows.Count > 0)
DataTable dt = dataSet.Tables[dataTableName].Clone(); ;
int c = 0;
foreach (DataRow r in dataSet.Tables[dataTableName].Rows)
DataRowState state = r.RowState;
switch (state)
case DataRowState.Modified:
DataRow anewrow_dr = dt.NewRow();
anewrow_dr.ItemArray = r.ItemArray;
dt.Rows.Add(anewrow_dr);
c = c + 1;
break;
default:
break;
if (c > 0)
return dt;
else
return null;
else
return null;
} -
OracleDataAdapter.Fill returns incorrect data for small numbers.
Hi All,
Recently we moved to Oracle client 11.1.0.7.20 with ODP.NET and instant client.
And we encountered the following issue.
When FetchSize of the command is set to any value that differs from default for some number fields with size <5 incorrect values are returned.
I used the following code to reproduce the issue:
var query = "SELECT * FROM RT ORDER BY ID";
var connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=server)(PORT=1531)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test)));User Id=user;Password=password;";
var column = "IS_LEAF"; // data type is NUMBER(1, 0)
using (var connection = new OracleConnection(connectionString))
using (var cmd1 = connection.CreateCommand())
using (var cmd2 = connection.CreateCommand())
cmd1.CommandText = query;
cmd2.CommandText = query;
cmd2.FetchSize = 512*1024; // 512K
var adapter1 = new OracleDataAdapter(cmd1);
var table1 = new DataTable();
adapter1.Fill(table1);
var adapter2 = new OracleDataAdapter(cmd2);
var table2 = new DataTable();
adapter2.Fill(table2);
for (int i = 0; i < table1.Rows.Count; i++)
var row1 = table1.Rows;
var row2 = table2.Rows[i];
if (!object.Equals(row1[column], row2[column]))
Console.WriteLine(string.Format("values don't match: {0}, {1}", row1[column], row2[column]));
there are some ouput lines:
values don't match: 0, 3328
values don't match: 0, 3
values don't match: 1, 3
values don't match: 0, 318
values don't match: 0, 264
values don't match: 1, 10280
values don't match: 1, 842
values don't match: 1, 7184
The column type is NUMBER(1, 0) and only values in the database are 1 or 0. So as you can see most of the values filled with custom fetch size are totally incorrect.
We have several tables with small number fields and for some of them the issue reproduces but for others does not.
And the issue doesn't appear:
1. with Oracle client 11.1.0.6.20
2. if I use data readers and compare values record by record.
Our Oracle DB version is 10.2.0.4.
Thanks,
Maxim.For anyone that may find this at a later time, this behavior has now been corrected, and is available in 11107 Patch 31 and newer, available on My Oracle Support. Note that the "self tuning=false" did not work in all cases, so the only reliable solution is to get the patch.
Greg -
Requerying in WHEN-BUTTON-PRESSED
Hi,
I have two forms. I have a button that opens up modal form 2 from form 1 and passes some parameters. I allow the user to update something in form 2 (which has an effect on form 1). When user exits form 2, I want to requery the block in form 1 so that any updates effected in form 2 can be visible.
I tried putting in a do_key('execute_query') in the WHEN-BUTTON-PRESSED trigger in form 1 after the call to open form 2. This had no effect (probably because it didn't get called when I expected it to). The only way I am able to get the new data (after an update in form 2) is to manually issue a requery in form 1.
Any suggestions would be deeply appreciated!
Thanks,
NiranjanHi Niranjan
Put the Execute_query in the when-new-form-instance of the Called form.
With Regards
Harish
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Niranjan Ramakrishnan:
Hi,
I have two forms. I have a button that opens up modal form 2 from form 1 and passes some parameters. I allow the user to update something in form 2 (which has an effect on form 1). When user exits form 2, I want to requery the block in form 1 so that any updates effected in form 2 can be visible.
I tried putting in a do_key('execute_query') in the WHEN-BUTTON-PRESSED trigger in form 1 after the call to open form 2. This had no effect (probably because it didn't get called when I expected it to). The only way I am able to get the new data (after an update in form 2) is to manually issue a requery in form 1.
Any suggestions would be deeply appreciated!
Thanks,
Niranjan<HR></BLOCKQUOTE>
null -
Requerying MS Access table?
Hi,
Ok, I got my insert statement to work now using a preparedstatement. I noticed now that my JTable doesn't reflect the new record unless I stop and restart my application.
I'm using a JTabbedPane and adding a class that extends AbstractTableModel on one tab. On another tab I have a JPanel with my controls for inserting a record.
I setup a ChangeHandler and add it to the listener of the JTabbedPane, this detects when I switch tabs. If the current tab is my table tab I set the tableModel = null and rebuild it. This seemed the best approach. When I do this I get an SQLException from the tableModel.getValueAt() method saying the result set is closed.
Here's what I think is the pertenant code (let me know if you want to see something else):
private class ChangeHandler implements ChangeListener
public void stateChanged( ChangeEvent e )
if ( tabbedPane.getSelectedIndex() == 0 )
tableModel = null;
buildResultTable();
} // end if
} // end method stateChanged
} // end private inner class ChangeHandler
public void buildResultTable()
// create TableModel
tableModel = new MyTableModel( dbConnection );
try
tableModel.setQuery(
"SELECT date, odometer, trip_meter, no_gallons FROM records ORDER BY date desc" );
} // end try
catch ( SQLException sqlException )
JOptionPane.showMessageDialog( null, sqlException.getMessage(),
"Database Error - buildResultTable", JOptionPane.ERROR_MESSAGE );
} // end catch
// create JTable delegate for tableModel
resultTable = new JTable( tableModel );
resultTablePane = new JScrollPane( resultTable );
} // end method buildResultTable
public void setQuery( String query ) throws SQLException, IllegalStateException
// ensure database connection is available
if ( !connectedToDatabase )
throw new IllegalStateException( "Not Connected to Database" );
// specify query and execute it
resultSet = statement.executeQuery( query );
if ( resultSet == null )
System.out.println( "Query didn't work!" );
// obtain meta data for ResultSet
metaData = resultSet.getMetaData();
// determine number of rows in ResultSet
resultSet.last(); // move to last row
numberOfRows = resultSet.getRow(); // get row number
// notify JTable that model has changed
fireTableStructureChanged();
} // end method setQuery
public Object getValueAt( int row, int column ) throws IllegalStateException
if ( !connectedToDatabase )
throw new IllegalStateException( "Not Connected to Database" );
// obtain value at specified REsultSet row and column
try
resultSet.absolute( row + 1 );
return resultSet.getObject( column + 1 );
} // end try
catch ( SQLException sqlException )
JOptionPane.showMessageDialog( null, sqlException.getMessage(),
"Database Error - getValueAt", JOptionPane.ERROR_MESSAGE );
} // end catch
return ""; // if problems, return empty string object
} // end method getValueAt
I'm new to Java so I'm sure there's a better way to do what I'm trying to do. Any ideas where I went wrong or a better way to do it? Any help is greatly appreciated.
Thanks in advance,
LinnOk, I got my insert statement to work now using a
preparedstatement. I noticed now that my JTable
doesn't reflect the new record unless I stop and
restart my application.MS Access? That question is asked every week here.
Here's an instance I picked at random from a forum
search for "access insert":
http://forum.java.sun.com/thread.jspa?forumID=48&threa
dID=348300Yeah, I thought it would be a common issue but I've spent the better part of three days going over google searches for this answer but no luck yet. Probably just haven't found the right combination of search terms yet.
I checked that forum thread you suggest and it, like all the others I've found, don't actually answer the question. They all seem to end with someone asking the original poster for more information and that's the end of the discussion thread.
Maybe if I rephrase the question, here's what I'm doing...
I query Access and build a JTableModel from a resultset.
I insert a new record into Access.
I switch over to Access and see that the record is inserted, Access shows that the insertion worked. (I switch tasks in Windows without quiting out of my Java app.)
I switch back to my Java app. and look at the table and the inserted record is not there yet.
So, what I'm thinking is that I need to "requery" the Access database and the new record should be included. My question is, how do I do that? How do I requery or refresh my resultset?
Oh, let me mention that I open the database connection and setup statement and resultset objects when I launch my app. and close them when I exit the app.
If I simply try to requery the database it throws an sqlException in the getValueAt() method of my TableModel extension class.
sqlException: Result set is closed is the message and is thrown by the line resultSet.absolute( row + 1 ); Here is the getValueAt() method code:
public Object getValueAt( int row, int column ) {
// obtain value at specified ResultSet row and column
try {
resultSet.absolute( row + 1 );
return resultSet.getObject( column + 1 );
catch ( SQLException sqlException ) {
sqlException.printStackTrace();
return ""; // if problems, return empty string object
} // end method getValueAt
Any help is greatly appreciated.
Thanks,
Linn -
OracleDataAdapter with IN or IN-OUT parameters is not supported
We are getting this message when we are trying to preview the data when creating an OracleDataAdapter with a SQL statement that has a parameter.
What does this mean and is there a work-around for it as I'd really like to create a typed dataset from an SQL Statement.
(If it means what I think it means, then I'm beginning to doubt the usefulness of using the Oracle Data Provider over MS version.)Hello,
I have the same problem with Flat mode is not supported! at ... Characteristic.setHierarchy(Characteristic.java:335):
Open, close, reload of the query does not help.
Other SDN-thread "500 Internal Sever - Flat Mode is not Supported!" related to transaction RSRT.
Execution of query via RSRT works, but the problem still persists in the BEx Web Analyzer.
Could be related to a BEx Web Analyzer "bookmark" ("Personalize Web Application").
I have not deleted any item. We use SAP BW 7.0 with a patch level approx. 09.2009.
The "flat-mode" seems to be the "BEx table mode".
SAP hints do not seem to fit here:
- 715820 BW 3.x Front-End Patch 14 (we use BW 7.0)
- 874825 SAPBWNews for BW 3.x Front-End Support Package 19
- 874827 SAPBWNews for BW 3.5 Front-End Patch 08 (we use BW 7.0)
- 905229 update to SAPTableTree
- 909824 Termination in flat mode when an object is deleted (old?)
- 909827 Incorrect InfoProvider-dependent characteristic values
- 910602 Condition includes too many characteristics (usage of deleted elements)
- 915215 Termination when a query definition is changed (old? visibility of elements?)
- 968273 Cache with flat files: Exception is not caught (does not apply to given error)
Any new solutions?
Best regards
Thomas -
Requery Condition with custom save button.
Hi,
I've set the 'Requery Condition' for my group equal to 'After Commit' and it doesn't seem to refresh my page when I do a commit using a custom button bound to my method in the managed bean.
Do I need to do anything extra in my bean where I am committing the record in order to make the 'Requery Condition' work on my group ?
Thanks,
ShishirHi,
It depends on your version of JHeadstart what is happening with the Save functionality. In general, you should 'copy' whatever JHeadstart is doing.
In my 10.1.3 version, it executes the action 'Commit' and the actionListener '#{bindings.Commit.execute}'. So indeed, try to execute the Commit binding as HJHorst told you, which should cause the onCommit functionality in the JHeadstart PageLifecycle class to fire and set the #{jhsAfterCommit} we were talking about before.
Take a look at the JhsPageLifecycle class, onCommit function and you know what I will mean. This class 'captures' commit functionality, which will not be captured if you simply call getDBTransaction().commit().
Regards
Evert-Jan de Bruin
Maybe you are looking for
-
The display becomes blocky, and can no longer be read
Websites develop distortion in both text and pictures, thought it is more noticeable in text. Horizontal lines shift from left to right a pixel or two, sometimes more when it's really bad. i've seen some shift entire letters. this makes it very diffi
-
Hi, Can someone share with me if I can default the goods receipt indicator as unselected? Currently, it is a display field and marked as selected. Where is the control in defaulting the goods receipt indicator? Thanks in advance.
-
Not able to access my remote machine using VPN in Windows 8. VPN connected successfully resulting internet disconnection . I am using Wireless 3G datacard device for internet. But the same VPN connection is working fine in WIFI & I able to access re
-
How to ignore a variable defined in a query when the query gets executed
Hi SAP guru, I am creating a query, which has a user input variable, say A, and a replacement path variable, say B, Bu2019s value is determined by A and the whole purpose of A is letting user entering an initial value and A must be ignored when the q
-
Problem with intercompany invoicing
Hi guys, We have this auto LIV being configured in our company and for some reason when an invoice is being generated it would create inbound invoice correctly but could'nt post it, because its giving a status message 51 saying that "The IDOC does no