FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ADO SQL VISIBILITY
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: ADO SQL VISIBILITY
Posted: Tue Jun 30, 2015 11:51 AM

SELECT * FROM INFORMATION_SCHEMA.TABLES

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: ADO SQL VISIBILITY
Posted: Wed Jul 01, 2015 07:24 AM
Mr Antonio

Please try this on different databases and see if this works.

Code (fw): Select all Collapse
function LastAutoIncID( cTable, cPrimaryKey, oCn )

   local oRs, nRet

   oRs   := oCn:OpenSchema( 12, { nil, nil, nil, nil, ctable } )
   oRs:Filter  := "COLUMN_NAME = '" + cPrimaryKey + "'"
   nRet        := oRs:Fields( "CARDINALITY" ):Value

return nRet

Notes: (1) You need to add error checking later
(2) Use this only if AUTOINCREMENT primary key exists

Added:
This works with MSACCESS, MSSQL and MYSQL
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: ADO SQL VISIBILITY
Posted: Thu Jul 02, 2015 02:47 AM
dagiayunus wrote:Dear Sir(s)

I have one table in sql database. if USER1 is browsing ARTICLE
table and make some changes, how to to update/visible USER2 browse with the
same change?

Something like dbf. when we change records it update to every where.



Regards
Yunus.


When we browse a DBF, we see other usres' changes to a row when we "move" to that row.
We do not see any changes by other users automatically, without navigating the browse.

To get the same effect, while creating the browse, add this line:
oBrw:bChange := { || oBrw:oRs:Resync( 1, 2 ), oBrw:RefreshCurrent() }
When a user moves browse cursor to any row, he will see the latest values of that row, as modified by other users.

In case of DBF, when we refresh the browse, we see all changes to all rows that are visible in the browse window.
To get the same effect:
oBrw:bOnRefresh := { || oBrw:oRs:Requery() }

As we go on things get a bit more complex, which need to learn step by step.

Talking about multi-user issues, ADO is more secure in handling multi-user conflicts than DBF.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion