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: 9345
Registriert: Do, 22. Sep 2005 23:11
Wohnort: Berlin
Hat sich bedankt: 100 Mal
Danksagung erhalten: 359 Mal
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag 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.
Herzlich,
Tom
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: MICROSOFT SQL and DBF using at the same time

Beitrag 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 :!:
gruss by OHR
Jimmy
Benutzeravatar
brandelh
Foren-Moderator
Foren-Moderator
Beiträge: 15689
Registriert: Mo, 23. Jan 2006 20:54
Wohnort: Germersheim
Hat sich bedankt: 65 Mal
Danksagung erhalten: 33 Mal
Kontaktdaten:

Re: MICROSOFT SQL and DBF using at the same time

Beitrag 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.
Gruß
Hubert
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

Re: MICROSOFT SQL and DBF using at the same time

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

SQL EXPRESS is the BEST tool for using SQL

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: SQL EXPRESS is the BEST tool for using SQL

Beitrag 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.
gruss by OHR
Jimmy
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

MICROSOFT SQL - BROWSE - sql EXPRESS

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

SQL EXPRESS - BROWSE

Beitrag von engindenizoglu »

I'm using SQl express.

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

SQL EXPRESS - BROWSE

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: SQL EXPRESS - BROWSE

Beitrag 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 :?:
gruss by OHR
Jimmy
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

Re: MICROSOFT SQL and DBF using at the same time

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: MICROSOFT SQL and DBF using at the same time

Beitrag 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
gruss by OHR
Jimmy
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

Re: MICROSOFT SQL and DBF using at the same time

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: MICROSOFT SQL and DBF using at the same time

Beitrag 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 ;-)
gruss by OHR
Jimmy
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

Re: MICROSOFT SQL and DBF using at the same time

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
HaPe
1000 working lines a day
1000 working lines a day
Beiträge: 995
Registriert: So, 15. Nov 2015 17:44
Wohnort: 71665 Vaihingen-Enz
Hat sich bedankt: 17 Mal
Danksagung erhalten: 15 Mal

Re: MICROSOFT SQL and DBF using at the same time

Beitrag 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".
--
Hans-Peter
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

Re: MICROSOFT SQL and DBF using at the same time

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

Re: MICROSOFT SQL and DBF using at the same time

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

LARA ltd
http:\\www.laraelectromechanical.com
Benutzeravatar
engindenizoglu
Cut&Paste-Entwickler
Cut&Paste-Entwickler
Beiträge: 41
Registriert: Mi, 08. Nov 2017 20:58
Wohnort: ISTANBUL

Re: MICROSOFT SQL and DBF using at the same time

Beitrag von engindenizoglu »

How is it possible to close the Browser by entering or right click mouse only ?

Regards
Engin Rene
ENGIN RENE D.

LARA ltd
http:\\www.laraelectromechanical.com
Antworten