Seite 2 von 2

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Di, 28. Nov 2017 22:10
von Tom
You misunderstood. SQL knows NULL/NIL as a valid value of a database field. Xbase++ does not - an empty field always returns it‘s correct datatype. In you want to have this with SQL, you need to configure the engine to return empty values in the fields are NIL. This is not a big thing.

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Mi, 29. Nov 2017 5:07
von AUGE_OHR
engindenizoglu hat geschrieben: Di, 28. Nov 2017 21:01I think this should be not a big deal fixing those kinds of problems for XBASE ++ ALASKA TEAM.
write it into alaska newsgroup ... perhaps some guy from alaska will read it there :!:

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Mi, 29. Nov 2017 8:13
von brandelh
I am thinking the DBF way, so never accept a null in a SQL Table.
I use default Values there. And I would not expect fast solutions from Alaska.

I do use SQLexpress if I need a SQL Table.

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Mi, 29. Nov 2017 9:11
von engindenizoglu
FACTS ABOUT XBASE++ and SQL;

If there is a NULL related the field --> change the SQL select command;

instead of;

Code: Alles auswählen

WERNER="SELECT TOP 100 MOULDTYPE,ORDERNO,ORDERITEMNO FROM  FROM ACIK_SATISSIPARISLERI;"
USE (WERNER) VIA ODBCDBE        
the corrected is below;

Code: Alles auswählen

WERNER="SELECT TOP 100 ISNULL(MOULDTYPE,'') AS MOULDTYPE,ORDERNO,ORDERITEMNO FROM  FROM ACIK_SATISSIPARISLERI;"
USE (WERNER) VIA ODBCDBE       

Code: Alles auswählen

ISNULL(MOULDTYPE,'') AS MOULDTYPE
---> otherwise if this field gets NULL ---> XBASE++ cannot define the value and we face ALWAYS errors.
This is solution in this case.


Best Regards
Engin Rene D.

SQL EXPRESS is the BEST tool for using SQL

Verfasst: Fr, 01. Dez 2017 19:48
von engindenizoglu
If you want to use SQL ; don't waste your time by trying ODBCDBE.

With xbase ODBCDBE you can face a lot of strange string variable errors that you can never find out the reason of it.

I would advise you all SQL EXPRESS !!!!

Re: SQL EXPRESS is the BEST tool for using SQL

Verfasst: Sa, 02. Dez 2017 3:09
von AUGE_OHR
engindenizoglu hat geschrieben: Fr, 01. Dez 2017 19:48 I would advise you all SQL EXPRESS !!!!
so how do you think will SQLexpress made Connection to SQL Server :?:

Connection "native" or via ODBC is only one Part. so also need to convert Data Type/Value and Method to handle it.
"that" is what SQLexpress as "Wrapper" is doing using ODBC.

MICROSOFT SQL - BROWSE - sql EXPRESS

Verfasst: Sa, 02. Dez 2017 21:09
von engindenizoglu
Does anyone know how BROWSE() a databank with SQL-EXPRESS ?

Code: Alles auswählen

 ***************************************************************************************************************************************  
   cConnect := "DRIVER=SQL Server;SERVER=ALCEPROJECT;DATABASE=TestDB;UID=TestUser;PWD=73kny!;"
   oConn := SQLConnection():new()
   IF oConn:DriverConnect(nil, cConnect, SQL_DRIVER_NOPROMPT)
     * MsgBox("i'm in")
     ELSE
      MSGBOX("SWe have a connection Problem !")
      RETURN
   ENDIF
   WERNER="SELECT * FROM VW_STOCK_CODES;"   
   oCursor := oConn:Cursor(WERNER)     
   oCursor:execute()
****************************************************************************************************************************************
ocursor:BROWSE() ---> is not working
or something like XBPBROWSE() ???

SQL EXPRESS - BROWSE

Verfasst: Mo, 04. Dez 2017 23:08
von engindenizoglu
I'm using SQl express.

How can i use BROWSE command for SQL DATABANKS ?

SQL EXPRESS - BROWSE

Verfasst: Mo, 04. Dez 2017 23:09
von engindenizoglu
I'm using SQl express.

How can i use BROWSE command for SQL DATABANKS ?

Is there a similar command like BROWSE in XBASE for SQ-Express ?

Re: SQL EXPRESS - BROWSE

Verfasst: Mo, 04. Dez 2017 23:23
von AUGE_OHR
engindenizoglu hat geschrieben: Mo, 04. Dez 2017 23:08 I'm using SQl express.
what about reading Manual and try supplied Demos :?:

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Di, 05. Dez 2017 22:20
von engindenizoglu
Do you mean the 5 sample prg's under the directory \sqlxpp ? In generall the documantation doc of SQLEXPRESS are insufficient.
I can remember during the 90's we could find a lot of books (materials) about clipper , dbase and we could learn easily everything from these books.

I would suggest to establish a common archieve for xbase programmers ; where newcomers like us could examine the short written samples
The topics could be like ; SQLexpress , XBASE2.0 ,Activex.........

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Mi, 06. Dez 2017 0:36
von AUGE_OHR
i mean Help File ...
as i say xb2net is a Xbase++ "Wrapper" CLASS so you have to use those Methode Boris provide

Boris Forum :
http://www.sqlexpress.net/sqlxpp/SQLXpp.htm
http://news.xb2.net/newsgroups.php?group=sqlexpress

Xbase++ Wiki
https://wiki.xbaseentwickler.de/index.p ... Hauptseite

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Sa, 09. Dez 2017 8:32
von engindenizoglu
Just a simple sample,

My SQL fields (2 fields only) are:

Code: Alles auswählen

engin:=oCursor:FieldGet("CUSTOMER_CODE")
 engin1:=oCursor:FieldGet("CUSTOMER_NAME")
The SQL connection string is like below:

Code: Alles auswählen

oCursor := oConn:Cursor("SELECT CUSTOMER_CODE,CUSTOMER_NAME FROM pr_CUSTOMER ORDER BY CUSTOMER_CODE ;")
 oCursor:execute()
How should be these fields formulated in DCBROWSE ??? It's maybe a simple question for others but i'm new in SQL ; that's why
i need a firestarter hint.

I usually use DBBROWSE ; what should be the name of the field from SQL ?

Code: Alles auswählen

DCBROWSECOL FIELD .....?.....  HEADER 'kodno' WIDTH 10
DCBROWSECOL FIELD ....?....... HEADER 'TANIM' WIDTH 20

Code: Alles auswählen

-----------------------------------------------------------------------------------------------------------------------------------------
@ 6,0 DCBROWSE oBrowCust ;
      DATA ocursor ;
      SIZE 175,12 ;
      PRESENTATION DC_BrowPres() ;
      NOSOFTTRACK ;
      SCOPE ;
      FONT "12.MS Sans Serif";
      NOHSCROLL ;
      ITEMMARKED {|| GITHESAPLA(OBROWCUST), DC_GetRefresh(GetList,, ;
                      DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE}) }  ;
      SCOPE ;
      CURSORMODE  XBPBRW_CURSOR_ROW ;
      ITEMSELECTED {||DC_GetRefresh(GetList,,DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE})  }


DCSETPARENT oBrowCust

DCBROWSECOL FIELD .....?.....  HEADER 'kodno' WIDTH 10
DCBROWSECOL FIELD ....?....... HEADER 'TANIM' WIDTH 20
DCSETPARENT TO

DCGETOPTIONS SAYFONT '10.Helv Bold' TABSTOP AUTORESIZE
DCGETOPTIONS HILITEGETS GRA_CLR_YELLOW


DCREAD GUI ;
   FIT ;
   OPTIONS GetOptions ;
   MODAL ;
   TITLE 'DETAYLAR' ;
   EVAL {|o|SetAppFocus(oBrowCust:GetColumn(1))}
------------------------------------------------------------------------------------------------------------------------

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Sa, 09. Dez 2017 8:52
von AUGE_OHR
hi,

i have followed a Thread about SQL Express and "SET RELATION" to 2nd Table.
Boris Advice :

"Take a look at the sample SQLTEST3.PRG included with SQLExpress. This
sample shows how to create a parent/child relation between 2 dataset
objects"

> It is important, using code block in second dataset :
>
> oDetails:= SQLDataSet():new("SELECT * FROM [Orders Detail] WHERE
> [Order ID]=?", oConn, {||{oOrders:FieldGet('Order ID')}}, {'Order
> ID'})

The codeblock in the 2nd (child) dataset is there to provide the paramater
value (?) for the WHERE condition. Each time you skip in the parent dataset
(oOrders), the paramater for the child (oDetails) changes. This way the the
child dataset gets refreshed.
---

Question to Express+++ i recommend to ask at Roger Forum direct.
http://bb.donnay-software.com/donnay/index.php
most User of this Forum does not use SQL yet and not all are Express++ User ;-)

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Sa, 09. Dez 2017 12:29
von engindenizoglu
I tried this command ; it's working but before it opens the SQL databank i get sql errors like ;
cannot insert NULL into column.....

-----------------------------------------------------------------------------------------------
DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'CUSTOMER_CODE' ) ;
PARENT oBrowse WIDTH 12 HEADER 'KODNO'

DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'CUSTOMER_NAME' ) ;
PARENT oBrowse WIDTH 40 HEADER 'ADI'
-------------------------------------------------------------------------------------------------

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Sa, 09. Dez 2017 13:01
von HaPe
Hallo Engin !
cannot insert NULL into column...
You have to set on SQL-Server in Management-Studio/-Admin-/xxx NULL values are allowed in this Column.
The default-behaviour when creating an SQL-Server-Table is "NULLs are not allowed".

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Sa, 09. Dez 2017 22:30
von engindenizoglu
I solved the problem. Below i added the whole dcbrowse CONCEPT.
We have here 2 fields for browsing ; CUSTOMER_CODE,CUSTOMER_NAME

A complete example is in \exp20\samples\sql\sqlbrow.prg --> from EXPRESS++

------------------------------------------------------------------------------------------------------------------------------
// establish the ODBC ROGER DONNAY - EXPRES++
cConnectString := 'DRIVER=SQL Server;SERVER=ALCEPROJECT;DATABASE=TestDB;UID=TestUser;PWD=1P_73kny!!;'
cTableName := 'pr_CUSTOMER'
BAGLAN="SELECT CUSTOMER_CODE,CUSTOMER_NAME FROM pr_CUSTOMER ;"

cStatement :=BAGLAN
oConnection := SQLConnection():new()
oConnection:driverConnect(nil, @cConnectString) /* BU OLMADAN EXPRESS CALISMAZ */

if ! oConnection:isConnected
DC_WinAlert("WE HAVE A PROBLEM !")
Return
endif

oCursor := CreateSQLCursor( oConnection, 2, cStatement )
IF Valtype(oCursor) # 'O'
RETURN
ENDIF

@ 6,0 DCBROWSE oBrowCust ;
DATA ocursor ;
SIZE 175,22 ;
PRESENTATION DC_BrowPres() ;
NOSOFTTRACK ;
SCOPE ;
FONT "12.MS Sans Serif";
NOHSCROLL ;
ITEMMARKED {|| GITHESAPLA(OBROWCUST), DC_GetRefresh(GetList,, ;
DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE}) } ;
SCOPE ;
CURSORMODE XBPBRW_CURSOR_ROW ;
ITEMSELECTED {||DC_GetRefresh(GetList,,DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE}) }

DCSETPARENT oBrowCust

DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'CUSTOMER_CODE' ) ;
PARENT oBrowse WIDTH 12 HEADER 'KODNO'

DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'CUSTOMER_NAME' ) ;
PARENT oBrowse WIDTH 40 HEADER 'ADI'

DCGETOPTIONS ;
AUTORESIZE ;
BUTTONALIGN DCGUI_BUTTONALIGN_CENTER

DCSETPARENT TO

DCGETOPTIONS SAYFONT '10.Helv Bold' TABSTOP AUTORESIZE
DCGETOPTIONS HILITEGETS GRA_CLR_YELLOW

DCREAD GUI ;
FIT ;
OPTIONS GetOptions ;
MODAL ;
TITLE 'DETAYLAR';
EVAL {|o|SetAppFocus(oBrowCust:GetColumn(1))}

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: Sa, 09. Dez 2017 22:30
von engindenizoglu
engindenizoglu hat geschrieben: Sa, 09. Dez 2017 22:30 I solved the problem. Below i added the whole dcbrowse CONCEPT.
We have here 2 fields for browsing ; CUSTOMER_CODE,CUSTOMER_NAME

A complete example is in \exp20\samples\sql\sqlbrow.prg --> from EXPRESS++

------------------------------------------------------------------------------------------------------------------------------
// establish the ODBC ROGER DONNAY - EXPRES++
cConnectString := 'DRIVER=SQL Server;SERVER=ALCEPROJECT;DATABASE=TestDB;UID=TestUser;PWD=1P_7IKU!;'
cTableName := 'pr_CUSTOMER'
BAGLAN="SELECT CUSTOMER_CODE,CUSTOMER_NAME FROM pr_CUSTOMER ;"

cStatement :=BAGLAN
oConnection := SQLConnection():new()
oConnection:driverConnect(nil, @cConnectString) /* BU OLMADAN EXPRESS CALISMAZ */

if ! oConnection:isConnected
DC_WinAlert("WE HAVE A PROBLEM !")
Return
endif

oCursor := CreateSQLCursor( oConnection, 2, cStatement )
IF Valtype(oCursor) # 'O'
RETURN
ENDIF

@ 6,0 DCBROWSE oBrowCust ;
DATA ocursor ;
SIZE 175,22 ;
PRESENTATION DC_BrowPres() ;
NOSOFTTRACK ;
SCOPE ;
FONT "12.MS Sans Serif";
NOHSCROLL ;
ITEMMARKED {|| GITHESAPLA(OBROWCUST), DC_GetRefresh(GetList,, ;
DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE}) } ;
SCOPE ;
CURSORMODE XBPBRW_CURSOR_ROW ;
ITEMSELECTED {||DC_GetRefresh(GetList,,DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE}) }

DCSETPARENT oBrowCust

DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'CUSTOMER_CODE' ) ;
PARENT oBrowse WIDTH 12 HEADER 'KODNO'

DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'CUSTOMER_NAME' ) ;
PARENT oBrowse WIDTH 40 HEADER 'ADI'

DCGETOPTIONS ;
AUTORESIZE ;
BUTTONALIGN DCGUI_BUTTONALIGN_CENTER

DCSETPARENT TO

DCGETOPTIONS SAYFONT '10.Helv Bold' TABSTOP AUTORESIZE
DCGETOPTIONS HILITEGETS GRA_CLR_YELLOW

DCREAD GUI ;
FIT ;
OPTIONS GetOptions ;
MODAL ;
TITLE 'DETAYLAR';
EVAL {|o|SetAppFocus(oBrowCust:GetColumn(1))}

Re: MICROSOFT SQL and DBF using at the same time

Verfasst: So, 10. Mär 2019 20:30
von engindenizoglu
How is it possible to close the Browser by entering or right click mouse only ?

Regards
Engin Rene