Nested Cursor in PB using MS SQL SERVER as db

Hi,
   I am migrating PB/ASA application to PB/ SQL Server 2000.
I have a nested frontend cursor
used to populate a treeview control as below.

Declare cr_dept_id Cursor For
Select dept_id, dept_name From t_department_master(nolock)
Where dept_id <> :gi_dept_id And dept_id > 0;

Open cr_dept_id;

Fetch cr_dept_id Into :li_dept_id, :ls_dept_name;

l_iCount1 = 1

Do While SQLCA.SQLCODE = 0

     ll_handle = tv_items.InsertItemSort( par_hand,
ls_dept_name, 1 )
     l_iCount1++
          //inner cursor for retrieving individual accounts
from accounts table
          Declare cr_test_id Cursor For
          Select t_patient_details.test_id From
t_patient_details(nolock),t_test_master(nolock)
          Where t_patient_details.test_id =
t_test_master.test_id
          And t_test_master.dept_id = :li_dept_id
          And t_patient_details.test_selection = 'Y'
          And t_patient_details.lab_id = :ll_lab_id
          And t_patient_details.lab_type = :ls_lab_type;

          Open cr_test_id;

          Fetch cr_test_id Into :ls_test_code;
          Int li_count = 1
          g_iIndent = 1
          Do While sqlca.sqlcode = 0
               g_iIndent++
               tv_items.InsertItemSort(ll_handle,
ls_test_code, 1 )
               li_count++
               Fetch cr_test_id Into :ls_test_code;
          Loop

          Close cr_test_id;

     // Fetch next record from main cursor
     Fetch cr_dept_id Into :li_dept_id, :ls_dept_name;
Loop

Close cr_dept_id;

At the point of
Fetch cr_test_id Into :ls_test_code; execution in the inner
cursor i get the following error.

[Microsoft][ODBC SQL Server Driver]Connection is busy with
results for another hstmt

Even instead of a inner cursor if i have a dw_1.retrieve()
within a cursor i get the same error.

Is there some setting in dbparm i have to set. Below is my
dbparm settings

SQLCA.DBParm= "ConnectString='DSN=AILM;UID=sa;PWD=sa;
DelimitIdentifier='No',MsgTerse='Yes',CallEscape='No',FormatArgsAsExp='N''"

Regards
Suresh
0
Suresh
5/17/2004 3:49:05 AM
sybase.powerbuilder.database 9855 articles. 1 followers. Follow

0 Replies
829 Views

Similar Articles

[PageSpeed] 57

Reply:

Similar Artilces:

Nested Cursors with MS SQL Server 2000 using OLE-DB
Hi I'm using PB7 Build (10135) with SQL Server 2000 (SP2). (MDAC 2.7 Installed) In powerbuilder script when I declare two nested cursors the inner one give this error "Cannot Create ne connection because in manual or distributed transaction mode" after the Open Cursor statement. I connect using Microsoft OLEDB. How can I solve this? Thanx Try using two different connetions for the two cursors. Some databases won't allow you to do a select against the database on a connection that already had another result set pending on it. On Wed, 22 May 2002 17...

Problems with db-library and ODBC using with MS SQL Server ver 7.0 PowerBuilder ver 6.5. And OLE-DB for Microsoft OLAP Services
There are many problems when running the aplication using the new ODBC driver for SQL ver 7. Simple, does not work. It�s any patch to this problem ? Using DB Library makes poor query plans in some case using SQL Server 7.0. It�s any path ? It�s any patch or utility to use OLE-DB for connecting Microsoft OLAP Services ? Carlos Lara darsa@solnet.com.mx ...

PB 8.0.0.1
We have a module whereby we insert/update records using a SP. We grab all the datawindow column values into variables and execute the SP using those variables. The SP has 90 parameteres. I get a GPF when calling this SP using OLE DB. The same thing works fine using native driver. I am using PB 8.0.1 ( Build 8004 ) and MS SQL Server 7.0 on a Windows 2000 computer. Any help in this matter will be appreciated. Thanks, Ashish. Are any of those parameters OUT parameters? Are you calling the stored procedure in embedded SQL or as via RPCFUNC on the transaction object? ...

connecting PowerBuilder 10 to MS-SQL Server using OLE DB: Problems with trailing blanks in StringType Data
HI. We work on a project using PowerBuilder 9.0.1 connected to a MS-SQL Server DataBase. Now we want to upgrade to PB 10, and we've realized that we have to use OLE DB to connect to our DataBase. OK, we've made the connection via OLE DB, now we are starting to have some unexpected troubles.. For instance: In datawindows retrieving String Type data, the OLE DB connection give us all the string data without trimming the trailing blank spaces...With PowerBuilder 9 (and its native MSSQL Server interface), the String data would come all trimmed down...i.e.: "HELLO"...

connecting PowerBuilder 10 to MS-SQL Server using OLE DB: Problems with trailing blanks in StringType Data
HI. We work on a project using PowerBuilder 9.0.1 connected to a MS-SQL Server DataBase. Now we want to upgrade to PB 10, and we've realized that we have to use OLE DB to connect to our DataBase. OK, we've made the connection via OLE DB, now we are starting to have some unexpected troubles.. For instance: In datawindows retrieving String Type data, the OLE DB connection give us all the string data without trimming the trailing blank spaces...With PowerBuilder 9 (and its native MSSQL Server interface), the String data would come all trimmed down...i.e.: "HELLO"...

PB 5.0 cursor fetch error using MS SQL Server 6.5 (Service Pack 5)
We have PB5.0.02 and are upgrading to PB5.0.04 for Y2K compliance. Both are 16 bit. We have been using MS SQL Server 6.50.201 (the original release). Everything has been fine. We have just put MS SQL Server 6.50.415 (Service Pack 5) on a test server for Y2K compliance and are getting cursor fetch errors using either version of PB5.0. The error is 10037 "unexpected EOF from SQL Server." In looking at the SQL error log we see an EXCEPTION_ACCESS_VIOLATION error message involving sp_cursorfetch. Does this rings any bells with anyone? Is there an upgraded dll (or dlls) ...

PB 5.0 (16 bit) cursor fetch error using MS SQL Server 6.5 (Service Pack 5)
We have PB5.0.02 and are upgrading to PB5.0.04 for Y2K compliance. Both are 16 bit. We have been using MS SQL Server 6.50.201 (the original release). Everything has been fine. We have just put MS SQL Server 6.50.415 (Service Pack 5) on a test server for Y2K compliance and are getting cursor fetch errors using either version of PB5.0. The error is 10037 "unexpected EOF from SQL Server." In looking at the SQL error log we see an EXCEPTION_ACCESS_VIOLATION error message involving sp_cursorfetch. Does this rings any bells with anyone? Is there an upgraded dll (or dlls) ...

Porting Ms Sql Server 6.5 database to Ms Sql Server 7.0
Hi, We have developed a product using PowerBuilder7.0, Ms Sql Server 6.5 and connecting them using powerbuilder native driver. Now we are thinking of porting Ms Sql Server 6.5 database to Ms Sql Server 7.0.As we feel, we could achive new features of Sql server 7.0.e.g row level locking. Actually i want to know, what things i have to do.e.g what sort of connection i have to use? what new features i will able to use?.will Stored procedures work properly. Is there anyting i have to chang in my application(at front end)e.g datawindows or any embeded sql, external functions. Should i po...

Porting Ms Sql Server 6.5 Database to Ms Sql Server 7.0
Hi, We have developed a product using PowerBuilder7.0, Ms Sql Server 6.5 and connecting them using powerbuilder native driver. Now we are thinking of porting Ms Sql Server 6.5 database to Ms Sql Server 7.0.As we feel, we could achive new features of Sql server 7.0.e.g row level locking. Actually i want to know, what things i have to do.e.g what sort of connection i have to use? what new features i will able to use?.will Stored procedures work properly. Is there anyting i have to chang in my application(at front end)e.g datawindows or any embeded sql, external functions. Should i po...

How to prevent SQL Native Client from using Server Side Cursor when connecting to MS SQL 2000
Hi. I am now trying to connect to MS SQL 2000 using SQLNCLI10 / SQLNCLI as Provider. I can connect to the database successfully but I observe that the sql native client generates sp_cursoropen, sp_cursorfetch etc even for a very simple select statement embedded in PowerScript. I think this will greatly impact the performance. I have found that the select statement becomes a single statement batch (no more sp_cursoropen etc) in the profiler trace if the database is changed to MS SQL 2008. How can I avoid it ? Add some setting to ProviderString in...

PROBLEM with PB 7.0.3 AND SQL SERVER 7.0 USING SQL CURSOR
I am having a problem running a sql command with a cursor with Native drivers for MS sql Server 7.0.If i use ODBC or take out the order by clause in the statement it works fine By the way I am running powerbuilder 7.0.3 build 10009 The error code is : (Error 10008 (DB-Library) DB-Library Severity Level 9 Message Text ad token from SQL Server: Datastream processing out of synchronization) here a sample of the code DECLARE cur_Sec1 CURSOR FOR SELECT DISTINCT COL1,COL2 FROM TABLE1 WHERE COL1 = ??? ORDER BY COL1 ASC ; <<<<<<<<<<< ...

PowerBuilder, connecting to MS SQL Server using MSS native driver: A field which is defined as a varchar (450) is truncated to 255 characters in PowerBuilder
PowerBuilder, connecting to MS SQL Server using MSS native driver: A field which is defined as a varchar (450) is truncated to 255 characters in PowerBuilder I am using Power Builder 7.0 with SQL Server 2000 Database. I created a datawindow using a varchar(450) field. It is allowing me enter and save 450 characters but when I retrieved the data it is truncating it to 255 chars. I looked in the database all 450 characters are there. Why it is truncating the data on retrieve? Please help me out if anybody knows the solution Thanks in advance because the native interface (Micr...

How to add users to a SQL Server DB used for authentication using SQL query
Hi, I am looking for a simple way to add users manually to a SQL Server DB (set up using aspnet_regsql.exe) via a SQL query. What are the required values, that have to be set in the different tables? Thanks in advance, Markus By default SqlMembershipProvider calls the aspnet_Membership_CreateUser stored procedure to create a user, you can use T-SQL statment like sp_help aspnet_Membership_CreateUser to learn how to use it.Welcome to my SQL/ASPNET forum for Chinese http://51up.org/bbs/forumdisplay.php?fid=38...

SQL Server instance Error
Hi Guys, I created a default website in VS2008 & dragged in a webpartmanager into the div section (i was going to have a play with creating web parts). I tried to preview the default page to seeif it runs but i get the following error: Server Error in '/WebSite1' Application. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - E...

Web resources about - Nested Cursor in PB using MS SQL SERVER as db - sybase.powerbuilder.database

Nested stack automaton - Wikipedia, the free encyclopedia
Like a stack automaton , a nested stack automaton may step up or down in the stack, and read the current symbol; in addition, it may at any place ...

Indie Impressions - Nested - YouTube
A really strange and kinda amazing little experiment/experience by developer Orteil. A whole universe stacked up in a text based hierarchy for ...

How to create nested folders in iOS 8
... 8 (because there are a lot of them). Nesting folders on iOS 8 is easy to do and completely reversible… At this moment, we’ve test the nested ...

This iOS 7 Beta Glitch Lets You Create Functional Nested Folders
... of Newsstand with iOS 7 beta . Now, another glitch has been discovered by VBarraquito on Twitter that lets you create fully functional nested ...

Windows 10 Insider Preview Build 10565 introduces support for nested virtualization
... its Windows-as-a-service strategy, employing the help of Windows Insiders to test all the major changes. One such change is support for nested ...

Shakshuka: Eggs Nested in Spicy Tomato Sauce
... sauce that adds a punch of taste along with its burn. It's a fiery way to wake up! Genie] A recipe for Shakshuka (shakshouka), or eggs nested ...

Gmail Adds Nested Labels and Message Preview
... Folders4Gmail and Mihai Parparita's Conversation Preview , two scripts with similar functionality to the new Gmail Labs experiments. Nested ...

Recapitulation in Nested Evolutionary Dynamics
... …The cosmos is "selfishly" focused upon the overarching objective of achieving its own replication.” Gardner concludes with another nested spiral ...

nested baker set
... want to serve it in, which for me tends to be something simple and ceramic. Judy Jackson is one of my favorite ceramicists, and these new nested ...


Resources last updated: 12/21/2015 2:40:05 PM