Das Forentreffen 2018 findet am 20./21. April in Dresden statt. Weitere Infos hier
Anmeldungen zum Forentreffen 2018 sind auf der Anmeldeseite möglich
Zur Homepage des Deutschsprachige Xbase-Entwickler e. V.
Xbase++-Wiki des Deutschsprachige Xbase-Entwickler e. V.

MICROSOFT SQL and DBF using at the same time

SQL Express von Boris Borzic

Moderator: Moderatoren

Benutzeravatar
Tom
Der Entwickler von "Deep Thought"
Der Entwickler von "Deep Thought"
Beiträge: 6866
Registriert: Do, 22. Sep 2005 23:11
Wohnort: Berlin
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von Tom » Di, 28. Nov 2017 22:10

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.
Herzlich,
Tom

Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 10723
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von AUGE_OHR » Mi, 29. Nov 2017 5:07

engindenizoglu hat geschrieben:
Di, 28. Nov 2017 21:01
I 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 :!:
gruss by OHR
Jimmy

Benutzeravatar
brandelh
Foren-Moderator
Foren-Moderator
Beiträge: 13900
Registriert: Mo, 23. Jan 2006 20:54
Wohnort: Germersheim
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von brandelh » Mi, 29. Nov 2017 8:13

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.
Gruß
Hubert

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von engindenizoglu » Mi, 29. Nov 2017 9:11

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.
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

SQL EXPRESS is the BEST tool for using SQL

Beitrag von engindenizoglu » Fr, 01. Dez 2017 19:48

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 !!!!
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 10723
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg

Re: SQL EXPRESS is the BEST tool for using SQL

Beitrag von AUGE_OHR » Sa, 02. Dez 2017 3:09

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.
gruss by OHR
Jimmy

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

MICROSOFT SQL - BROWSE - sql EXPRESS

Beitrag von engindenizoglu » Sa, 02. Dez 2017 21:09

Does anyone know how BROWSE() a databank with SQL-EXPRESS ?

***************************************************************************************************************************************
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() ???
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

SQL EXPRESS - BROWSE

Beitrag von engindenizoglu » Mo, 04. Dez 2017 23:08

I'm using SQl express.

How can i use BROWSE command for SQL DATABANKS ?
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

SQL EXPRESS - BROWSE

Beitrag von engindenizoglu » Mo, 04. Dez 2017 23:09

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 ?
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 10723
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg

Re: SQL EXPRESS - BROWSE

Beitrag von AUGE_OHR » Mo, 04. Dez 2017 23:23

engindenizoglu hat geschrieben:
Mo, 04. Dez 2017 23:08
I'm using SQl express.
what about reading Manual and try supplied Demos :?:
gruss by OHR
Jimmy

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von engindenizoglu » Di, 05. Dez 2017 22:20

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.........
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 10723
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von AUGE_OHR » Mi, 06. Dez 2017 0:36

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
gruss by OHR
Jimmy

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von engindenizoglu » Sa, 09. Dez 2017 8:32

Just a simple sample,

My SQL fields (2 fields only) are:
engin:=oCursor:FieldGet("CUSTOMER_CODE")
engin1:=oCursor:FieldGet("CUSTOMER_NAME")

The SQL connection string is like below:
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 ?

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


-----------------------------------------------------------------------------------------------------------------------------------------
@ 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))}
------------------------------------------------------------------------------------------------------------------------
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 10723
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von AUGE_OHR » Sa, 09. Dez 2017 8:52

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 ;-)
gruss by OHR
Jimmy

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von engindenizoglu » Sa, 09. Dez 2017 12:29

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'
-------------------------------------------------------------------------------------------------
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
HaPe
Rekursionen-Architekt
Rekursionen-Architekt
Beiträge: 273
Registriert: So, 15. Nov 2015 17:44
Wohnort: 71665 Vaihingen-Enz

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von HaPe » Sa, 09. Dez 2017 13:01

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".
--
Hans-Peter

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von engindenizoglu » 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_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))}
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 25
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von engindenizoglu » Sa, 09. Dez 2017 22:30

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))}
ENGIN RENE D.

LARA ltd
hhtp:\\www.core-winder.com
http:\\www.laraelectromechanical.com
http:\\www.lara-plastics.com

Antworten