hmgversiyon 4 and mysql and / or ado - mssql connection When can we do?
I think there is currently only on the development of graphical user interface.
ado - mssql - mysql
Moderator: Rathinagiri
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: ado - mssql - mysql
As you have correctly said, HMG 4 is now concentrating on GUI via QT. Except for dbf field/browsing features, all other databases can be connected even now since it is based on mingw. If you have mysql/sqlite/mssql libraries to connect, I think even now we can connect as usual.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: ado - mssql - mysql
And... an area of QT that we do not explored yet, is the plugins (we do only for images).rathinagiri wrote:As you have correctly said, HMG 4 is now concentrating on GUI via QT. Except for dbf field/browsing features, all other databases can be connected even now since it is based on mingw. If you have mysql/sqlite/mssql libraries to connect, I think even now we can connect as usual.
QT includes redistributable plugins to handle sqlite and ODBC that could give us a grid with built in support for any back-end.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: ado - mssql - mysql
this sample, roberto's rdd sample.
and modified hbqt4
#include "../../include/hmg.ch"
Set Procedure To ../../source/hmg
REQUEST SDDODBC, SQLMIX
#define RDDI_CONNECT 1001
PROC main()
RDDSETDEFAULT( "SQLMIX" )
SET( 4, "yyyy-mm-dd" )
RDDINFO( RDDI_CONNECT, { "ODBC", "DBQ=" + "test.mdb;Driver={Microsoft Access Driver (*.mdb)}" } )
DBUSEAREA( .T.,, "select * from test", "test" )
INDEX ON FIELD->SALARY TO salary
DBGOTOP()
With Object oWindow := Window():New()
:Row := 10
:Col := 10
:Width := 400
:Height := 450
:Title := 'Nice OOP Demo!!!'
:Type := WND_MAIN
:OnInit := { || oWindow:Center() }
With Object oGrid := Grid():New()
:Row := 10
:Col := 10
:Width := 320
:Height := 300
:ColumnWidths := {150,60,70}
:ColumnHeaders := {'First','Last','Salary'}
:Rowsource := 'TEST'
:ColumnFields := {'First','Last','Salary'}
:CellNavigation := .T.
End With
End With
oWindow:Activate()
rETURN
this program not compiling (error code undefined reference to 'HB_FUN_SDDODBC' and 'HB_FUN_SQLMIX')
and modified hbqt4
#include "../../include/hmg.ch"
Set Procedure To ../../source/hmg
REQUEST SDDODBC, SQLMIX
#define RDDI_CONNECT 1001
PROC main()
RDDSETDEFAULT( "SQLMIX" )
SET( 4, "yyyy-mm-dd" )
RDDINFO( RDDI_CONNECT, { "ODBC", "DBQ=" + "test.mdb;Driver={Microsoft Access Driver (*.mdb)}" } )
DBUSEAREA( .T.,, "select * from test", "test" )
INDEX ON FIELD->SALARY TO salary
DBGOTOP()
With Object oWindow := Window():New()
:Row := 10
:Col := 10
:Width := 400
:Height := 450
:Title := 'Nice OOP Demo!!!'
:Type := WND_MAIN
:OnInit := { || oWindow:Center() }
With Object oGrid := Grid():New()
:Row := 10
:Col := 10
:Width := 320
:Height := 300
:ColumnWidths := {150,60,70}
:ColumnHeaders := {'First','Last','Salary'}
:Rowsource := 'TEST'
:ColumnFields := {'First','Last','Salary'}
:CellNavigation := .T.
End With
End With
oWindow:Activate()
rETURN
this program not compiling (error code undefined reference to 'HB_FUN_SDDODBC' and 'HB_FUN_SQLMIX')
Re: ado - mssql - mysql
- modify 1
#
# $Id: hbmk.hbm 15253 2010-08-01 12:32:44Z vszakats $
#
../../../harbour/contrib/hbqt/hbqtcore.hbc
../../../harbour/contrib/hbqt/hbqtgui.hbc
../../../harbour/contrib/hbqt/hbqtnetwork.hbc
sddodbc.hbc
rddsql.hbc
- modify 2
copy sddodbc.hbc and rddsql.hbc to this program directory
- and modify program
#ifdef __HBIDE__
#include "hmg.ch"
#else
#include "../../include/hmg.ch"
#endif
Set Procedure To ../../source/hmg
REQUEST SDDODBC, SQLMIX
#define RDDI_CONNECT 1001
#define RDDI_CONNECT 1001
#define RDDI_DISCONNECT 1002
#define RDDI_EXECUTE 1003
#define RDDI_ERROR 1004
#define RDDI_ERRORNO 1005
#define RDDI_NEWID 1006
#define RDDI_AFFECTEDROWS 1007
#define RDDI_QUERY 1008
Function Main
Local oWindow, oBrowse
RDDSETDEFAULT( "SQLMIX" )
RDDINFO( RDDI_CONNECT, { "ODBC", "SERVER=SK\SQLEXPRESS;DATABASE=TANGO;Driver={SQL Native Client};UID=sa;" } )
DBUSEAREA( .T.,, "select * from STOK_K ", "DEMO" )
Index on demo->STOK_K_ID to first
go top
With Object oWindow := Window():New()
:Row := 10
:Col := 10
:Width := 800
:Height := 480
:Title := 'Nice OOP Demo!!!'
:Type := WND_MAIN
:OnInit := { || oWindow:Center() }
With Object oBrowse := Browse():New()
:Row := 10
:Col := 10
:Width := 750
:Height := 450
:WorkArea := 'demo'
:OnDblClick := { || MsgInfo('Double Clicked!') }
End Width
End With
oWindow:Activate()
Return NIL
- this program connect to ms-sql server and browsing records
thanks
best regards
salim
bursa-turkey
#
# $Id: hbmk.hbm 15253 2010-08-01 12:32:44Z vszakats $
#
../../../harbour/contrib/hbqt/hbqtcore.hbc
../../../harbour/contrib/hbqt/hbqtgui.hbc
../../../harbour/contrib/hbqt/hbqtnetwork.hbc
sddodbc.hbc
rddsql.hbc
- modify 2
copy sddodbc.hbc and rddsql.hbc to this program directory
- and modify program
#ifdef __HBIDE__
#include "hmg.ch"
#else
#include "../../include/hmg.ch"
#endif
Set Procedure To ../../source/hmg
REQUEST SDDODBC, SQLMIX
#define RDDI_CONNECT 1001
#define RDDI_CONNECT 1001
#define RDDI_DISCONNECT 1002
#define RDDI_EXECUTE 1003
#define RDDI_ERROR 1004
#define RDDI_ERRORNO 1005
#define RDDI_NEWID 1006
#define RDDI_AFFECTEDROWS 1007
#define RDDI_QUERY 1008
Function Main
Local oWindow, oBrowse
RDDSETDEFAULT( "SQLMIX" )
RDDINFO( RDDI_CONNECT, { "ODBC", "SERVER=SK\SQLEXPRESS;DATABASE=TANGO;Driver={SQL Native Client};UID=sa;" } )
DBUSEAREA( .T.,, "select * from STOK_K ", "DEMO" )
Index on demo->STOK_K_ID to first
go top
With Object oWindow := Window():New()
:Row := 10
:Col := 10
:Width := 800
:Height := 480
:Title := 'Nice OOP Demo!!!'
:Type := WND_MAIN
:OnInit := { || oWindow:Center() }
With Object oBrowse := Browse():New()
:Row := 10
:Col := 10
:Width := 750
:Height := 450
:WorkArea := 'demo'
:OnDblClick := { || MsgInfo('Double Clicked!') }
End Width
End With
oWindow:Activate()
Return NIL
- this program connect to ms-sql server and browsing records
thanks
best regards
salim
bursa-turkey
-
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
Re: ado - mssql - mysql
Dear skonuk:skonuk wrote:- modify 1
#
# $Id: hbmk.hbm 15253 2010-08-01 12:32:44Z vszakats $
REQUEST SDDODBC, SQLMIX
......
#define RDDI_CONNECT 1001
#define RDDI_CONNECT 1001
#define RDDI_DISCONNECT 1002
#define RDDI_EXECUTE 1003
#define RDDI_ERROR 1004
#define RDDI_ERRORNO 1005
#define RDDI_NEWID 1006
#define RDDI_AFFECTEDROWS 1007
#define RDDI_QUERY 1008
.......
bursa-turkey
I read you artical about connecting to SQL server with HMG. Thanks to people like you and mol, I did connect to SQL server express 2005 successfully.
Meanwhile, I notice that you define RDD number such as 1002,1003 other than 1001. are they corresponding to specific SQL statement or other purposes?
Could you tell me more info about RDDINFO() ,or where I could I those information. Besides, do you know what else value RDDIFNO() will return other than zero? If do, what are they stand for?
Best Regrads
chen min
Re: ado - mssql - mysql
Greetings,
not efficient for me with the sql connection rddinfo
The following is another example. The connection is established with hbodbc here.
A crucial part of the auto increment value which is important sahanında be taken after the insert is a great example I think.
odbc connection to MS SQL Server 2008 version of this is connected with success, inserts post-process percentage values for auto increment column brought back with success.
I am interested in a very amateurish. better try to send the samples.
Good luck and good work
#include "simpleio.ch"
#include "sql.ch"
#xcommand GET ROW <nRow> INTO <cVar> => ;
<cVar> := Space( 128 ) ;;
SQLGetData( hStmt, <nRow>, SQL_CHAR, Len( <cVar> ), @<cVar> )
PROCEDURE Main()
LOCAL hEnv := 0
LOCAL hDbc := 0
LOCAL hStmt := 0
LOCAL cConstrin
LOCAL cConstrout := Space( 1024 )
LOCAL nRows := 0
LOCAL nid := 0
? "Version: " + hb_NumToHex( hb_odbcVer() )
cConstrin :="Driver={SQL Server Native Client 10.0};Server=SK\SQLEXP;Database=TANGO;Uid=SA;Pwd=;"
? PadC( "*** ODBC ACCESS TEST ***", 80 )
?
? "Allocating environment... "
SQLAllocEnv( @hEnv )
? "Allocating connection... "
SQLAllocConnect( hEnv, @hDbc )
? "Connecting to driver " + cConstrin + "... "
SQLDriverConnect( hDbc, cConstrin, @cConstrout )
? "Allocating statement... "
SQLAllocStmt( hDbc, @hStmt )
?
sqlexecdirect( hstmt, "INSERT INTO test (kolon1,kolon2,kolon3,kolon4) VALUES ('EqqS','ddd','eee','eee') ")
?
sqlexecdirect( hstmt, "SELECT * FROM TEST where a1=@@identity")
DO WHILE SQLFetch( hStmt ) == 0
nRows++
GET ROW 5 INTO nid
* GET ROW 2 INTO cFunc
* GET ROW 3 INTO cState
* GET ROW 4 INTO cComm
* GET ROW 5 INTO nid
? nid
* ? cCode, PadR( cFunc, 20 ), cState, cComm, nid
ENDDO
? "------------------------------------------------------------------------------"
? Str( nRows, 4 ), " row(s) affected."
SQLFreeStmt( hStmt, SQL_DROP )
SQLDisConnect( hDbc )
SQLFreeConnect( hDbc )
SQLFreeEnv( hEnv )
RETURN
not efficient for me with the sql connection rddinfo
The following is another example. The connection is established with hbodbc here.
A crucial part of the auto increment value which is important sahanında be taken after the insert is a great example I think.
odbc connection to MS SQL Server 2008 version of this is connected with success, inserts post-process percentage values for auto increment column brought back with success.
I am interested in a very amateurish. better try to send the samples.
Good luck and good work
#include "simpleio.ch"
#include "sql.ch"
#xcommand GET ROW <nRow> INTO <cVar> => ;
<cVar> := Space( 128 ) ;;
SQLGetData( hStmt, <nRow>, SQL_CHAR, Len( <cVar> ), @<cVar> )
PROCEDURE Main()
LOCAL hEnv := 0
LOCAL hDbc := 0
LOCAL hStmt := 0
LOCAL cConstrin
LOCAL cConstrout := Space( 1024 )
LOCAL nRows := 0
LOCAL nid := 0
? "Version: " + hb_NumToHex( hb_odbcVer() )
cConstrin :="Driver={SQL Server Native Client 10.0};Server=SK\SQLEXP;Database=TANGO;Uid=SA;Pwd=;"
? PadC( "*** ODBC ACCESS TEST ***", 80 )
?
? "Allocating environment... "
SQLAllocEnv( @hEnv )
? "Allocating connection... "
SQLAllocConnect( hEnv, @hDbc )
? "Connecting to driver " + cConstrin + "... "
SQLDriverConnect( hDbc, cConstrin, @cConstrout )
? "Allocating statement... "
SQLAllocStmt( hDbc, @hStmt )
?
sqlexecdirect( hstmt, "INSERT INTO test (kolon1,kolon2,kolon3,kolon4) VALUES ('EqqS','ddd','eee','eee') ")
?
sqlexecdirect( hstmt, "SELECT * FROM TEST where a1=@@identity")
DO WHILE SQLFetch( hStmt ) == 0
nRows++
GET ROW 5 INTO nid
* GET ROW 2 INTO cFunc
* GET ROW 3 INTO cState
* GET ROW 4 INTO cComm
* GET ROW 5 INTO nid
? nid
* ? cCode, PadR( cFunc, 20 ), cState, cComm, nid
ENDDO
? "------------------------------------------------------------------------------"
? Str( nRows, 4 ), " row(s) affected."
SQLFreeStmt( hStmt, SQL_DROP )
SQLDisConnect( hDbc )
SQLFreeConnect( hDbc )
SQLFreeEnv( hEnv )
RETURN
-
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
Re: ado - mssql - mysql
Dear skonuk:skonuk wrote:Greetings,
not efficient for me with the sql connection rddinfo
The following is another example. The connection is established with hbodbc here.
......
RETURN
Very thanks for replying to me. To be honest, it is really tough for me to understand. but I will keep trying.
Thank you again.
Best Regards
chen min