Two recordset
I need to retrieve two recordset from database using two query.....so how do I do that?
Whether I need to create two database connection or ....?
Anyone pls help....urgent...
Thanks in advance
No,you have not to create two connection, you have to istantiate two RecordSet objects from the same Connection and Statement object, something like this:
//instantiate connection
RecordSet rs1=yourStatement.executeQuery(query1);
RecordSet rs2=yourStatement.executeQuery(query2);
Similar Messages
-
How to fetch records with two recordset
i want fetch records from the table using two recordset like
ResultSet r1=stmt.executeQuery("select * from pf_data");
i want to take another recodeset
ResultSet r2=stmt.executeQuery("select * from finyr");
I am using Microsoft SQL server as my database.
I am also closing the recordset like r1.close();
then i cannot take two recordset at the same time.Hi,
This is an example of a Top-N problem, and here's one way to do it:
WITH got_r_num AS
SELECT item_id, supp_id, rnk -- RANK is not a good column name
, DENSE_RANK () OVER ( PARTITION BY item_id -- Just guessing
ORDER BY rnk
) AS r_num
FROM table_x
WHERE item_id = 2 -- If desired
SELECT item_id, supp_id. rnk
FROM got_r_num
WHERE r_num <= 2
RANK is the name of a built-in function in Oracle, so it will cause lots of trouble if you use it as a column name. (The RANK function is closely related to DENSE_RANK, used above.)
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Point out where the query above is giving the wrong results, and explain, using specific examples, how you get the correct results from the given data in those places. If you changed the query at all, post your code.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
I have two ADODB-connections in VBA to two different databases. I select the same field names in both databases. Is it somehow possible to merge these two recordset and remove duplicates with union and select distinct?
Hi,
You can make a database link from the first to the sencond database.
then you make an ADODB connection to the first database and query the union there.
In the first database:
CREATE DATABASE LINK second_db_link
CONNECT TO user_name IDENTIFIED BY password
USING 'second_db_name';From ADODB Client to first database
select
col1
,col2
,col3
from
table_1
union
select
col1
,col2
,col3
from
table_1@second_db_linkRegards,
Peter -
Is it possible to work with two recordsets in one method?
If so, I havnt been able to figure out how.
Any Suggestions?
StefSure. Why not? But your problem has nothing to with them being "in the same method". It's more likely to do with this quote from the API documentation for java.sql.Statement:
"Only one ResultSet object per Statement object can be open at any point in time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All statement execute methods implicitly close a statment's current ResultSet object if an open one exists." -
Common records from two recordset
Hi All,
I have a problem.Consider two recordsets A and B. I want
common records that are present in both A and B . Is there any easy
way to do this? Please help me out!!!!same principle:
<cfquery name="myQoQ" DBTYPE="query">
SELECT *
FROM query1, query2, query3
WHERE query1.somecolumn = query2.somecolumn
AND query1.somecolumn = query3.somecolumn
</cfquery>
but... unless your different queries query different
databases (as
opposed to different tables in the same db), it is better to
just use 1
(one) query to select all your data.
if you post you queries' code and how the tables are related
(through
which fields), we'll help you write one query that will pull
just the
data you need... unless you do use the queries individually
in your code
somewhere (i.e. you do need to use full recordset of all
queries
involved at some point in the page - if your queries are just
for
creating a QoQ, then you definitely better changing your 3
queries into
1 query!)
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/ -
How to compare two recordsets for common or difference or join (ASP)
Good day,
I have Adobe Dreamweaver CS3 and here is my question. I have created two recordsets, one called Active_Stu and the other is called Active_Emps. One deals with active employees and the other deals with active Students. Both hava ids of students and employees. The student id field is called stuid and the employee id field in the active employee record set is called empid. They are both integers and come from one table. Each recordset is a SQL query that work fine on its own. How can I join the two recordsets into a third recordset? How can I find the ids in one that is not in the other one? or the ones that both have in common? I can do all that in Access by bringing the two queries into the third one and do a left join or others but not sure how to do such action in the Dreamweaver.
I am using VB ASP for my development.
Any ideas?Don't try to join two recordsets to find rows different or in common between tables. You do the same as you would in Access. Just write a single SQL query that joins the tables. Depending on what exactly you are looking for, you would use inner joins, outer joins or sub-selects.
-
Ordering dated data from two recordsets?
So I have two different recordsets (two different databases,
two different
connection strings) being retrieved into an ASP/VBScript
page, and both
tables contain dated data.. and I need to combine both
recordsets into one
list.. can anyone point me to a clue as to how to handle
this???I have done a logical fact table with two fact table source on it.
The Sql performed against the database was this one.
-------------------- Sending query to database named PRODS_AIX (id: <<153418>>):
WITH
SAWITH0 AS (select sum(T21296.CONSUMERS_SALES_EURO) as c1,
T21309.DIVISION_CODE as c2
from
DIVISION T21309,
C_CONSUMERS_SALES T21296
where ( T21296.DIVISION = T21309.DIMENSION_KEY )
group by T21309.DIVISION_CODE),
SAWITH1 AS (select sum(T21356.ORDER_VALUE) as c1,
T21309.DIVISION_CODE as c2
from
DIVISION T21309,
DWH_SALES_ORDER_OVERVIEW T21356
where ( T21309.DIMENSION_KEY = T21356.DIVISION_KEY )
group by T21309.DIVISION_CODE)
select distinct case when SAWITH0.c2 is not null then SAWITH0.c2 when SAWITH1.c2 is not null then SAWITH1.c2 end as c1,
SAWITH0.c1 as c2,
SAWITH1.c1 as c3
from
SAWITH0 full outer join SAWITH1 On nvl(SAWITH0.c2 , 'q') = nvl(SAWITH1.c2 , 'q') and nvl(SAWITH0.c2 , 'z') = nvl(SAWITH1.c2 , 'z')
order by c1As you can see one select (SAWITH0) for the first fact table C_CONSUMERS_SALES and one select for the second fact table DWH_SALES_ORDER_OVERVIEW (SAWITH1 ) and the two statement are joined with a full outer join.
I ask me why you have the three select (SAWITH0,SAWITH1 and SAWITH2). Can you please paste the complete SQL performed ?
Can you tell us also which SQL is performed if you select only the columns from one fact table and not for the other ?
Regards
Nico
http://gerardnico.com -
Two recordset to display information on same page
Hi,
I am designing a webpage that calls from a specific entered value and at the same time should have a news headline calling from the same dbase on the same page.
On creating the record set I got the message
Warning: Supplied resource is not a valid MySQL-Link resource in c:\apache\htdocs\nusokoto\egovt.php on line 38
Warning: Supplied resource is not a valid MySQL-Link resource in c:\apache\htdocs\nusokoto\egovt.php on line 40
The line 38 and 40 is indicated below.
I will like you to please help me with this.
More so using ADDT can I create a master to detail page?
Thanks
Yomi
mysql_select_db($database_sokoto, $sokoto);
$query_sokoto = "SELECT * FROM onsite WHERE id = 7";
$sokoto = mysql_query($query_sokoto, $sokoto) or die(mysql_error());
$row_sokoto = mysql_fetch_assoc($sokoto);
$totalRows_sokoto = mysql_num_rows($sokoto);
(38) mysql_select_db($database_sokoto, $sokoto);
$query_news = "SELECT * FROM news WHERE topic = topic";
(40) $news = mysql_query($query_news, $sokoto) or die(mysql_error());
$row_news = mysql_fetch_assoc($news);
$totalRows_news = mysql_num_rows($news);
?>Hi Yomi,
"SELECT * FROM news WHERE topic = topic"
that should be "SELECT * FROM news WHERE topic = 'topic'"
More so using ADDT can I create a master to detail page?
Do you mean ADDT´s Dynamic Master and Detail Lists ?
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
How do i add recordsets to a .dwt.asp-generated page
help - i am at wits end.....
below is code for a page (test3.asp) based on a template
called "catalogue.dwt.asp". i need various recordsets on various
pages based on this template. f i try to add a recordset to
test3.asp, i'm told "making this change would involve changing cose
that is locked by a template or translator" - so i cant add the
recordsets (tho interestingly you can see that i did manage to
somehow add two recordsets at the outset before it started saying
this.
if i try to add the recordsets to the template (which is not
the way i want to do it anyway), i'm told i've added code outside
the html tag and wont be copied unless i add
<!--TemplateInfoOutsideHTMLIsLocked-->
i have bvuilt plenty of other sites where i DONT have this
issue so DW/me must be coding something different sometimes -
bottom line is - how do i get to having a .dwt.asp temaplte which i
can build other pages from, and then add relevant recordsets to.
i would be DEARLY GRATEFUL for anyone who can help me put
this perennial problem to bed.
thanks in advance:
Code attachedFunny, I have never seen anyone report this. And I've worked
with DW and
recordsets in template child pages for a mightly long time,
and never
experienced it. On the other hand, it's always a good idea to
restart your
system when things like this happen. You never know what
could be
interfering.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Ed Stewart" <[email protected]> wrote in message
news:fe80k0$4tb$[email protected]..
>> below is code for a page (test3.asp) based on a
template called
>> "catalogue.dwt.asp". i need various recordsets on
various pages based on
>> this
>> template. f i try to add a recordset to test3.asp,
i'm told "making this
>> change
>> would involve changing cose that is locked by a
template or translator" -
>> so i
>> cant add the recordsets (tho interestingly you can
see that i did manage
>> to
>> somehow add two recordsets at the outset before it
started saying this.
>>
>> if i try to add the recordsets to the template
(which is not the way i
>> want to
>> do it anyway), i'm told i've added code outside the
html tag and wont be
>> copied
>> unless i add
<!--TemplateInfoOutsideHTMLIsLocked-->
>>
>> i have bvuilt plenty of other sites where i DONT
have this issue so DW/me
>> must
>> be coding something different sometimes - bottom
line is - how do i get
>> to
>> having a .dwt.asp temaplte which i can build other
pages from, and then
>> add
>> relevant recordsets to.
>>
>> i would be DEARLY GRATEFUL for anyone who can help
me put this perennial
>> problem to bed.
>
>
>
>
> It's a bug. Close and re-open DW and your templated page
will accept the
> RS without squawking. -
Server Exception add activities in a recordset loop
Hello,
i want to add activities in a loop through business partners. I use two Recordset objects. "ores" for the loop through businesspartners and "orestemp" to read some data in the loop.
I get a server exception, somtimes on firts loop cycle somtimes... its sporadic. i dont know what the problem.
On VB6 it works fine but not under VB.NET.
here some code
orestemp = _oComp.GetBusinessObject SAPbobsCOM.BoObjectTypes.BoRecordset)
ores = _oComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
ores.DoQuery("SELECT....")
ores.MoveFirst()
For i = 0 To ores.RecordCount - 1
_oProgBar.Value = i
_v1 = ores.Fields.Item(0).Value
_v2 = ores.Fields.Item(1).Value
orestemp.DoQuery("SELECT...")
_v3 = orestemp.Fields.Item(0).Value
orestemp.DoQuery("SELECT")
_v4 = orestemp.Fields.Item(0).Value
oCont.CardCode = _v2
oCont.Details = _v3
ret = oCont.Add
ores.MoveNext()
Next
Thanks ChrisHello,
i want to add activities in a loop through business partners. I use two Recordset objects. "ores" for the loop through businesspartners and "orestemp" to read some data in the loop.
I get a server exception, somtimes on firts loop cycle somtimes... its sporadic. i dont know what the problem.
On VB6 it works fine but not under VB.NET.
here some code
orestemp = _oComp.GetBusinessObject SAPbobsCOM.BoObjectTypes.BoRecordset)
ores = _oComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
ores.DoQuery("SELECT....")
ores.MoveFirst()
For i = 0 To ores.RecordCount - 1
_oProgBar.Value = i
_v1 = ores.Fields.Item(0).Value
_v2 = ores.Fields.Item(1).Value
orestemp.DoQuery("SELECT...")
_v3 = orestemp.Fields.Item(0).Value
orestemp.DoQuery("SELECT")
_v4 = orestemp.Fields.Item(0).Value
oCont.CardCode = _v2
oCont.Details = _v3
ret = oCont.Add
ores.MoveNext()
Next
Thanks Chris -
Template, recordset and querystrings
hello,
i've got a problem that's vexing me. I am using ASP/VBScript
with DW CS3. I am trying to get a repeating region to populate.
I have a template and a child page of the template. On the
template page I created bindings that are associated with two
recordsets, which in turn use two stored procedures. I also have a
repeating region. In the repeating region I've put a field from the
second recordset.
The ASP code that appears in the template, before the
<HTML> tag appears, is the boiler plate stuff that DW
generated for me:
dim rsProc__vID
rsProc__vID = "570"
if ( vID = "" ) then
rsProc__vID = vID
end if
rsProc__cmd.Parameters.Append
rsProc__cmd.CreateParameters("param1", 5, 1, -1, rsProc__vID)
(I defined the vID variable when creating the binding. I used
570 because i knew it returned a recordset.)
However, i've overwritten this code in the child page, so
that it looks like this:
rsProc__vID = request.querystring("myParamVal")
So, the query string from the child page is what I want to
use as the parameter for the second stored procedure.
Meanwhile, the code that actually works with the repeating
region is in the template. This code resembles:
<% while ((rsProc__numRows <> 0 ) AND (NOT
rsProc__cmd.EOF))
%>
<!-- TemplateBeginRepeat name=""rrRepeat" -->
<% rsProc__cmd.Fields.Item("MyRepeatingField").Value)
%>
<!-- TemplateEndRepeat -->
I'm confused over the relationship between the template and
the child concerning which parameter is used for the stored
procedure. The template has the boiler plate code from DW that
defines the recordsets. The child overwrites this, and tries to use
the query string as the input into the stored procedure.
at the same time, the template has the code that defines the
looping that works with the repeating region.
I've used SQL Enterprise manager and verified that the query
string I use with the child page indicates an ID that returns a
recordset. However, when I use the query string on the child page,
the repeating region does not populate.
Ironically, the first record set, that is identical in both
parent and child pages, and which doesn't have a repeating region,
works perfectly fine in the child page.
Does anyone have any advice? Thanks.i moved the querystring code to the template, and suddenly
the child page is working.
i thought i had tried this initially. -
I'm not well versed in ASP. I have one page where I have 3
regions Two are recordsets. THe other is text that says "sorry no
items at this time" THe two recordsets are filtered by the URL
parameter. the recordsets show up correctly when the parameter is
passed. THe "sorry no items at this time" brings up the error:
ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been
deleted. Requested operation requires a current record.
IS there a way to get these 3 items to work together using IF
<% If rsAllType.EOF And rsAllType.BOF Then %>
<div><p>
<span class="subtitle">
<%=(rsAllCourses.Fields.Item("Type").Value)%> <%=(rsAllCourses.Fields.Item("SubType").Val ue)%>
Courses
</span><br /><br />
<% While ((Repeat4__numRows <> 0) AND (NOT
rsAllCourses.EOF)) %>
<span class="boldgray">
<a href="CourseDetail.asp?<%=
Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) &
"CourseID=" & rsAllCourses.Fields.Item("CourseID").Value
%>">
<%=(rsAllCourses.Fields.Item("Title").Value)%></a></span>
<br />
<%=(rsAllCourses.Fields.Item("Description").Value)%><br
/>
<span
class="bold">Prerequisites: </span><%=(rsAllCourses.Fields.Item("Prerequisites").Value)%>
<br /><br />
<% Repeat4__index=Repeat4__index+1
Repeat4__numRows=Repeat4__numRows-1
rsAllCourses.MoveNext()
Wend %>
</p></div>
<% End If ' end rsAllType.EOF And rsAllType.BOF %>
<% If rsAllCourses.EOF And rsAllCourses.BOF Then %>
<div>
<span
class="subtitle"><%=(rsType.Fields.Item("Type").Value)%> <%=(rsSubType.Fields.Item("SubTy pe").Value)%>
Courses</span><br />
<br />
No classes at this time, please check back soon. <br
/>
</p>
</div>
<% End If ' end rsAllCourses.EOF And rsAllCourses.BOF
%>
<% If Not rsAllType.EOF Or Not rsAllType.BOF Then %>
<p>
<span class="subtitle">All
Courses</span><span class="boldgray"> <br />
<br />
Listed
Alphabetically</span> <a
href="<%=MM_movePrev%>"><< Previous</a> <a
href="<%=MM_moveNext%>">Next >></a><br
/>
<br />
</p>
<%
While ((Repeat5__numRows <> 0) AND (NOT rsAllType.EOF))
%>
<div>
<p>
<span class="boldgreen">
<%=(rsAllType.Fields.Item("Title").Value)%></span><br
/>
<%=(rsAllType.Fields.Item("Description").Value)%><br />
<span
class="bold">Prerequisites: </span><%=(rsAllType.Fields.Item("Prerequisites").Value)%><br
/>
<span
class="bold">Category: </span><%=(rsAllType.Fields.Item("Type").Value)%><br
/>
<span
class="bold">Curriculum:</span><%=(rsAllType.Fields.Item("SubType").Value)%><br
/>
<br /></p>
</div>
<% Repeat5__index=Repeat5__index+1
Repeat5__numRows=Repeat5__numRows-1
rsAllType.MoveNext()
Wend %>
<% End If ' end Not rsAllType.EOF Or NOT rsAllType.BOF
%>redant34jessica wrote:
> If AllCourses NOT empty display AllCourses (there are
links on page to display
> this filtered recordset using URL Parameter - "TypeID")
<% If Not rsAllCourses.EOF Or Not rsAllCourses.BOF Then
%>
> If AllCourses empty and AllTypes NOT empty show AllTypes
(there is a link on
> page to display ALL using a URL Parameter- "Type")
If (rsAllCourses.EOF AND rsAllCourses.BOF) AND (NOT
rsAllTypes.EOF OR
NOT rsAllTypes.BOF) Then %>
> If AllCourses empty and AllTypes empty show warning
message (If there is no
> data a link on page where there is currently no data)
<% If rsAllCourses.EOF And rsAllCourses.BOF AND
rsAllTypes.EOF And
rsAllTypes.BOF Then %>
> Another Question is when a recordset is filtered by a
URL parameter, if that
> URL parameter does not exist in the URL is the recordset
EMPTY??
That depends on what you set the default value to be. I try
to use a
value that will never be used, like -1, so when the URL
parameter
doesn't exist, the recordset uses -1 instead. It won't find a
record
with -1 as the value, so returns an empty recordset.
> Please help. THank you very much!
See how you get on with the above.
Dooza
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.html
How To Report A Bug To Adobe
http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform -
Weird database related PHP issue
Basically I have a regular page that lists a bunch of
Candidates from a table :
CandidateID, Candidate
They link through to a details page on CandidateID
On the listing page, I also have a link to an Edit Candidate
Details page, using :
[CODE]
<a href="editCandidateEmail.php?CandidateID=<?php echo
$row_Candidates['CandidateID']; ?>"><img
src="../Images/edit7.gif" border="0" width="28px" height="18px"
/></a>
[/CODE]
Which works just as it should. So far so good.
On my details page, I have the exact same link to the edit
deatils page, using :
[CODE]
<a href="editCandidateEmail.php?CandidateID=<?php echo
$row_Candidates['CandidateID']; ?>"><img
src="../Images/edit7.gif" border="0" width="28px" height="18px"
/></a>
[/CODE]
The weird thing is that it works sometimes, but not others.
The error is :
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to
use near '' at line 1
And the URL is just missing the ID off the end of the link,
so looks like :
../editCandidateEmail.php?CandidateID=
Instead of
../editCandidateEmail.php?CandidateID=1234
The recordset is named 'Candidates', and there is a
CandidateID present.
Any clue as to what might be causing this?
Cheers.d'oh! Figured out what was happening - there were two
recordsets on the details page, and one involved a join to another
table - so if a CandidateID wasn't present in the other look up
table, it wasn't being referenced by that recordset - so I just
changed those links to refer to the simple recordset that referred
directly to the Candidates table. -
Content conversion parameters for fixed length file
Hi,
Hey i have a small doubt.My input is like this
99443 123213 232234 12312 127544 23423
Here i have four recorsetnames namely HEADER1,HEADER2,HEADER3,HEADER4,HEADER5,HEADER6 all the recordsets are of same size but the lengths of the fields in it vary so i specified the following parameters
HEADER1.fieldFixedLengths=1,3,1
HEADER1.fieldNames=value1,value2,value3
HEADER1.endseperator=" "
HEADER2.fieldFixedLengths=1,3,2
HEADER2.fieldNames=value1,value2,value3
HEADER2.endseperator=" "
MY OUPUT XML STRUCTURE SHOULD BE like this
<header1>
<value1>9<\value1>
<value2>944<\value2>
<value3>3<\value3>
<\header1>
<header2>
<value1>1<\value1>
<value2>232<\value2>
<value3>13<\value3>
<\header2>
Is the content conversion parameters i specified enough for that. I wanted to know how would it know the begin of the next recordset(ie the seperation between the two recordsets) .Please help me its vey urgent
Thanks in advance
SriandhAre header 1 fields always going to occur first , then header 2 and so on?
By default file adapters do not support Nested Strcutures and so if the sequence is going to be the same and all of these have an occurence of 1..1 then things will work.
But if there is going to be an occurnece of * then you will need to use KeyFields.
Regards
Bhavesh -
I have two recordsets: Recorsdset 1 results have an ID field. Recordset 2 results have an ID field
I want to show all records in Recordset 1 that are not in Recordset 2. For example.
Recordset 1 has
1
2
3
4
5
Recordset 2 has
1
3
4
I want the results to show
2
5
How can i accomplish this. It is ASP/VBScript with an access database.Do you need two recordsets? Why not just use one?
select MyId from MyTableOne where MyId not in (select MyId from MyTableTwo)
Of course, the where clause of the main and subqueries could be more complex but you get the idea.
Maybe you are looking for
-
Browse in Adobe Bridge CS6 - default to 64-bit version
I have Adobe Bridge CS6 32-bit and 64-bit installed. I prefer to use the 64-bit version, but whenever I right-click a folder in Windows Explorer and choose 'Browse in Adobe Bridge CS6', the 32-bit version always opens. How can I make this default to
-
Help with creating a new XML file from an existing DOM tree!!
i want to create a new XML file from an existing DOM tree i used this code to create a new document: static public Document createDocument(String fileName) throws ParserConfigurationException//,IOException,SAXException try {
-
Can't Change a User's Password - "Reset Password" is Grayed Out
I'm trying to reset a user account in OS X 10.4.11 on a MacBook. I am the administrator and am logged in as such. I have gone into System Preferences > Accounts and clicked the unlock icon, put in my admin password, and selected the other user from t
-
Problem with printing from an URL
Hi, my first post on this forum......so hello everyone !! Im trying to print a file on my server from a flash app, I have been using the printJob class. This function always spools the whole of my parent .swf file and not the file pointed at by the U
-
Adobe Flash Player Active X and Plugin Product Codes
Where can I find a list of all the Adobe Flash Player Active X and Plugin product codes? I am creating an uninstall script to cleanup any old versions and would like a complete up to date listing. This thread here has up to version 11.4 - http://foru