Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Arjun/Sangeeta Yadav
  Where is Arjun/Sangeeta Yadav?
 kolkata
 India
 Arjun/Sangeeta Yadav
 To: Raju Shrestha
  Where is Raju Shrestha?
 Kathmandu
 Nepal
 Raju Shrestha
 Tags
Subject: RE: how to get multiple record set
Thread ID: 396237 Message ID: 396256 # Views: 25 # Ratings: 0
Version: Visual FoxPro 9 Category: Projects and Design
Date: Friday, January 24, 2014 8:10:27 AM         
   


> > Hi, Experts
> >
> > I need a method to get multiple recordset from remote mysql database using a single SQLEXEC()
> >
> > like
> > ? SQLEXEC(nConnectionHandle,'select * from register where deedno='009' ;
> > select * from moujamast where moujacode='010' ;
> > select * from agents where active="ye" ;
> > select * from agentlevel where levelcode >3 and <=5)
> >
> > i try out with some examples but fail to acheive the result.
> >
> > Please help
> >
> > Thanks & Regards
>
>
>
> Hello,
>
> I recommend that you split those queries into multiple queries instead.
> VFP will retain those cursors in the current datasession anyway.
>
>
> = SQLEXEC(nConnectionHandle,"select * from register where deedno='009'",'curRegister')
> = SQLEXEC(nConnectionHandle,"select * from moujamast where moujacode='010'",'curMouJamast')
> = SQLEXEC(nConnectionHandle,"select * from agents where active='ye'",'curAgents')
> = SQLEXEC(nConnectionHandle,"select * from agentlevel where levelcode >3 and <=5",'curAgentLevel')
> 

>
> If you do difficult things with simple approach, your life will be easier. :-)


this is exactly what i am doing at present but i think that a single sql execution will be much faster to fatch the data
from the remote server.
So instead of giving the 4 execute command one by one i want to acheive the same in a single execution, any idea?



i try out the following but it returns the data from the first table only in item local cursor
where it is suppose to create cursor like ITEM and ITEM1.

can someone help me to read data from both the cursor as we do in case of single execution like follow

SQL_COMMAND="SELECT * FROM registry WHERE pjcode=?VPJCODE"
IF SQLEXEC(CONNECTION_VAR,SQL_COMMAND,"MYSQLREG")>0
SELECT MYSQLREG
BROW
ENDIF



DO CONN

= SQLSETPROP(CONNECTION_VAR, 'BatchMode', .F.) && Individual result sets
= SQLEXEC(CONNECTION_VAR, 'SELECT * FROM registry; SELECT * FROM moujamast','ITEM')



? SQLMORERES( CONNECTION_VAR,'ITEM' ) && First result set

IF SQLMORERES( CONNECTION_VAR,'ITEM' )>0
SELECT ITEM
BROW
ENDIF


? SQLMORERES( CONNECTION_VAR,'ITEM1' ) && Second result set UNABLE TO READ HERE

IF SQLMORERES( CONNECTION_VAR,'ITEM1' )>0
SELECT ITEM1
BROW
ENDIF



Thanks for your reply

ENTIRE THREAD

how to get multiple record set Posted by sangeeta yadav @ 1/23/2014 10:12:06 PM
RE: how to get multiple record set Posted by Pete Sass @ 1/23/2014 10:34:34 PM
RE: how to get multiple record set Posted by sangeeta yadav @ 1/24/2014 8:19:59 AM
RE: how to get multiple record set Posted by Raju Shrestha @ 1/24/2014 2:38:27 AM
RE: how to get multiple record set Posted by sangeeta yadav @ 1/24/2014 8:10:27 AM
RE: how to get multiple record set Posted by Tore Bleken @ 1/24/2014 8:15:10 AM
RE: how to get multiple record set Posted by Cetin Basoz @ 1/24/2014 1:12:57 PM