1. Sreekanth Thorpunuri
  2. PowerBuilder
  3. Monday, 21 October 2024 12:41 PM UTC

I am using the configuration below to connect to the database using the ADO.NET provider, and it connects successfully.

 // Profile ADOTest

SQLCA.DBMS = "ADO.Net"
SQLCA.LogPass = <**************>
SQLCA.LogId = "***"
SQLCA.AutoCommit = False
SQLCA.DBParm = "Provider='SQL Server',DataSource='SQL Server 2022',Database='ADO_Database'"

But when we called SQLCA.sqlnrows from the GetSQLCACode method, it returned zero. So, we can't implement the CURSOR in our application with the ADO.NET provider.

------------------------------------------

GetSQLCACode (){

i_code = SQLCA.sqlnrows

}

------------------------

DECLARE list CURSOR FOR
SELECT id
FROM sampletable
order by id;

ll_count = 0
Open list ;
DO WHILE TRUE
FETCH list INTO :ll_entity_id;
IF access.GetSQLCACode (SQLCA) > 0 THEN EXIT
ll_count ++
l_pbd_entity_id[ ll_count ] = ll_entity_id
Loop
Close list ;

 

Can you please let us know how to check SQLCA.sqlnrows and which parameters need to be provided for the ADO.NET provider?

 

David Xiong @Appeon Accepted Answer Pending Moderation
  1. Friday, 25 October 2024 02:18 AM UTC
  2. PowerBuilder
  3. # 1

Hi Sreekanth,

We are able to reproduce the issue where the SqlNRows value is incorrect after using fetch to retrieve data. We recommend that you submit this issue to our ticket system for easier follow-up. Once we have fixed it, we can also update you promptly through the ticket.

Regards,
David

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Monday, 21 October 2024 13:02 PM UTC
  2. PowerBuilder
  3. # 2

Hi.

What is GetSQLCACode method? It's written in which language? The snippet you provided doesn't look like powerscript...

You need to count what exactly? Maybe something like the following code (yours with some modifications) will do what's needed?

DECLARE list CURSOR FOR
SELECT id
FROM sampletable
order by id;

ll_count = 0
Open list ;

DO WHILE TRUE
	FETCH list INTO :ll_entity_id;
	if sqlca.sqlnrows < 1 then exit
	ll_count ++
	l_pbd_entity_id[ ll_count ] = ll_entity_id
Loop

Close list ;

Why aren't you using a datastore for that?

Andreas.

Comment
  1. Andreas Mykonios
  2. Tuesday, 22 October 2024 06:30 AM UTC
What is the access object containing the GetSQLCACode method? Are you sharing your connection with other applications? You are using SQL Server and going from odbc to ado.net. Why not going to Microsoft OLE DB Driver for SQL Server?

What version of powerbuilder are you using?

Andreas.
  1. Helpful
  1. Sreekanth Thorpunuri
  2. Wednesday, 23 October 2024 06:38 AM UTC
The access object contains the required parameters, such as the data source, database, login username, and password.

This access object's connection details work fine in other places, such as select statements and database connections. We are facing an issue when we call SQLCA.sqlnrows.

The reason for ADO.NET is that we also have C# code, which is already using ADO.NET.

And the version of PowerBuilder is PowerBuilder 2022 R3 (IDE & Runtime version is Version 2022 R3 Build 3391)
  1. Helpful
  1. David Peace (Powersoft)
  2. Wednesday, 23 October 2024 16:21 PM UTC
It may or may not be relevant, but we were supporting an application that used ADO.Net and it was very problematic. I cannot remember the specific issues now, but we vowed never to use ADO.Net again. I would recommend Microsoft OLE DB.



Sorry I cannot answer your specific question, and that it's not what you want to here. Changing course now may well save you a lot of heartache later.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.