ADO SQL VISIBILITY

Re: ADO SQL VISIBILITY

Postby nageswaragunupudi » Tue Jun 30, 2015 11:51 am

SELECT * FROM INFORMATION_SCHEMA.TABLES
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ADO SQL VISIBILITY

Postby nageswaragunupudi » Wed Jul 01, 2015 7:24 am

Mr Antonio

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

Code: Select all  Expand view  RUN
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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ADO SQL VISIBILITY

Postby nageswaragunupudi » Thu Jul 02, 2015 2: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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 30 guests