Seite 1 von 1

browse in xbase - for SQL - how can it be easiest done

Verfasst: Do, 14. Mär 2019 23:21
von engindenizoglu
Below i have showed a sample code for browsing a dbf file and selecting the right record.

Is there a sample prg which can browse from a SQL DATABANK (the name of the sql databank can be IPADRES ; field names ; NR, TANIM ;
(a similar sample like below) ?

Or a similar method of browsing and selecting a record from a SQL DATABANK (in xbase 2.0).


---------------------------- browse program ; the dbf file has 2 fields NR and TANIM ---------------------

******* DBF FILE *****************
SELECT 8
USE IP-ADRES SHARED
IF NETERR()=.T.
CLOSE ALL
RETURN
ENDIF
***********************************
GO TOP

APPBROWSE INTO oBrowse ;
for SUBSTR(CINS,1,1)="P";
TITLE "select the record" ;
FONT "14.MS Sans Serif";
POSITION CENTER, CENTER ;
SIZE 55,40 PERCENT;

APPFIELD ALLTRIM(NR) INTO oBROWSE CAPTION "NO";
ALIGN CENTER FONT "14.MS Sans Serif" COLOR GRA_CLR_WHITE,GRA_CLR_DARKGREEN READONLY

APPFIELD ALLTRIM(TANIM) INTO oBROWSE CAPTION "ANA TANIM";
ALIGN CENTER FONT "14.MS Sans Serif" COLOR GRA_CLR_WHITE,GRA_CLR_DARKGREEN READONLY

APPDISPLAY oBrowse MODELESS // Display Application Parts


KEYBOARD CHR(13)

DO WHILE nEvent <> xbeP_Close // Process events
nEvent := AppEvent( @mp1, @mp2, @obj )
obj:handleEvent( nEvent, mp1, mp2 )

IF NEVENT=1048609 /* MOUSE SOL TIKLA */
EXIT
ENDIF

IF NEVENT=1048977 /* ENTER to exit */
EXIT
ENDIF

IF NEVENT=1048628 .or. NEVENT=1048632 /* ESCAPE or mouse click to exit */
obrowse:DESTROY()
CLOSE ALL
RETURN
ENDIF


ENDDO


obrowse:DESTROY()

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


İyi çalışmalar\Regards
Engin René D.

Re: browse in xbase - for SQL - how can it be easiest done

Verfasst: Fr, 15. Mär 2019 7:52
von georg
Good morning -


you should start by making yourself familiar with the "normal" XbpBrowse() class. The APPBROWSE command is quite old (I would like to say "outdated") and assumes that you work with a "normal" Clipper-style workarea.

For a starter, you can copy the first example from the Xbase++ documentation and run it using the debugger.

Going back to your question:

Instead of accessing a fields' data with workarea->fieldname you need to use oData:fieldget("fieldname"), where oData is the DataSet() that you created using SQLExpress. You also need to change/rewrite the DbSkipper() function to work on your dataset.

I'll try to find an example in my programs and post it here.

Re: browse in xbase - for SQL - how can it be easiest done

Verfasst: Fr, 15. Mär 2019 8:38
von AUGE_OHR
as i remember Engin want to use M$SQL Server but that is not include in Xbase++ v2.x
Xbase++ have PgDBE for PostgreSQL only

SQLExpress using ODBC can access M$SQL but there is no ISAM Emulator like in PgDBE
download SQLExpress from https://www.xb2.net/sqlxpp/index.htm

have a look at those Sample if you understand it.

Re: browse in xbase - for SQL - how can it be easiest done

Verfasst: Fr, 15. Mär 2019 22:08
von engindenizoglu
I do use SQL EXPRESS and XBASE 2.0.

Re: browse in xbase - for SQL - how can it be easiest done

Verfasst: Sa, 16. Mär 2019 9:01
von AUGE_OHR
i guess SQLExpress have a lot of Sample.

Boris have also a Forum at www.xbwin.com -> forum -> SQLexpress so i recommend to ask there.

Re: browse in xbase - for SQL - how can it be easiest done

Verfasst: So, 17. Mär 2019 8:46
von engindenizoglu
I asked Boris about it he said its not related about sql rather about xbase alaska programming language.

Does anyone have a samples in xbase about browsing and selecting a record ?

Re: browse in xbase - for SQL - how can it be easiest done

Verfasst: So, 17. Mär 2019 10:00
von Tom
You may take a look at Roger Donnay's eXpress++ - there is a free trial, and the framework - including source - doesn't cost much. It has several samples for SQL-browsing in almost all situations. www.donnay-software.com