REQUEST HB_CODEPAGE_TRWIN
HB_CDPSELECT( "TRWIN" )
#include "fivewin.ch"
REQUEST HB_CODEPAGE_TRWIN
static oCn
function Main()
local oRs, oDlg, oBrw, oFont
HB_SetCodePage("TRWIN")
FWCONNECT oCn HOST "localhost" USER "root" PASSWORD "mypassw" DATABASE "test" PORT 3306 CHARSET "latin5"
oCn:lShowErrors := .T.
CreateTables()
oRs := oCn:RowSet( "SELECT CUSTID,FIRST FROM test_trk ORDER BY FIRST" )
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -12
DEFINE DIALOG oDlg SIZE 500,600 FONT oFont PIXEL TRUEPIXEL TITLE "EditBaseRecord()"
@ 70,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oRs AUTOCOLS AUTOSORT ;
COLSIZES -10, -30 ;
CELL LINES NOBORDER
oBrw:CreateFromCode()
@ 20, 20 BTNBMP PROMPT "ADD" SIZE 100,30 PIXEL FLAT OF oDlg ;
ACTION oRs:EditBaseRecord( nil, .t., { |oRec| MyEditDlg( oRec ) }, oBrw )
@ 20,130 BTNBMP PROMPT "EDIT" SIZE 100,30 PIXEL FLAT OF oDlg ;
ACTION oRs:EditBaseRecord( nil, .f., { |oRec| MyEditDlg( oRec ) }, oBrw )
@ 20,240 BTNBMP PROMPT "REFRESH" SIZE 100,30 PIXEL FLAT OF oDlg ;
ACTION ( oRs:Requery(), oBrw:Refresh(), oBrw:SetFocus() )
ACTIVATE DIALOG oDlg CENTERED
oFont:End()
return nil
function CreateTables()
oCn:DropTable( "test_trk" )
if !oCn:TableExists( "test_trk" )
oCn:CreateTable( "test_trk", { ;
{ "CUSTID", 'N', 3, 0, "PRI" }, ;
{ "FIRST", 'C', 20, 0 }, ;
{ "SECOND", 'C', 20, 0 } } )
oCn:Insert( "test_trk", "CUSTID, FIRST, SECOND", ;
{ {1, 'A', 'B'}, {2, 'Ş', 'B'}, {3, 'Z', 'B'}, {4, 'W', 'B'}, {5, 'B', 'B'}, ;
{6, 'Q', 'B'}, {7, 'N', 'B'}, {8, 'İ', 'B'}, {9, 'Ü', 'B'} } )
endif
return nil
static function MyEditDlg( oRec )
local lNew := ( oRec:RecNo == 0 )
local oDlg, oFont
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -12
DEFINE DIALOG oDlg SIZE 400,300 PIXEL TRUEPIXEL FONT oFont
@ 030,020 SAY "ID:" SIZE 80,20 PIXEL OF oDlg RIGHT
@ 060,020 SAY "First" SIZE 80,20 PIXEL OF oDlg RIGHT
@ 090,020 SAY "Second" SIZE 80,20 PIXEL OF oDlg RIGHT
@ 030,120 GET oRec:CUSTID SIZE 100,22 PIXEL OF oDlg
@ 060,120 GET oRec:FIRST SIZE 240,22 PIXEL OF oDlg
@ 090,120 GET oRec:SECOND SIZE 240,22 PIXEL OF oDlg
@ 140,020 BTNBMP PROMPT "Save" SIZE 150,30 PIXEL FLAT OF oDlg ;
ACTION ( If( oRec:Modified(), oRec:Save(), nil ), oDlg:End() )
@ 140,240 BTNBMP PROMPT "Cancel" SIZE 150,30 PIXEL FLAT OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED ON PAINT oDlg:Box( 15, 10, 125, 390 )
return nil
oRs := oCn:RowSet( "SELECT CUSTID,FIRST FROM test_trk" ) // ORDER BY FIRST" )
oRs:Sort := "FIRST"
oCn:CreateTable( "test_trk", { ;
{ "CUSTID", 'N', 3, 0, "PRI" }, ;
{ "FIRST", 'C', 20, 0 }, ;
{ "SECOND", 'C', 20, 0 } }, .F., "latin5_turkish_ci" )
again the same. Q and W comes after Z.
#include "fivewin.ch"
function main()
local aData := ;
{ {1, 'A', 'B'}, {2, 'S', 'B'}, {3, 'Z', 'B'}, {4, 'W', 'B'}, {5, 'B', 'B'}, ;
{6, 'Q', 'B'}, {7, 'N', 'B'}, {8, 'I', 'B'}, {9, 'Ü', 'B'} }
HB_SetCodePage("TRWIN")
XBROWSER aData AUTOSORT
return nil
A, B, C, Ç, D, E, F, G, Ğ, H, I, İ, J, K, L, M, N, O, Ö, P, Q, R, S, Ş, T, U, Ü, V, W, X, Y, Z
a, b, c, ç, d, e, f, g, ğ, h, ı, i, j, k, l, m, n, o, ö, p, q, r, s, ş, t, u, ü, v, w, x, y, z
oRs := oCn:RowSet( "SELECT ID, NAME FROM mytable ORDER BY name")
oRs:Sort := "NAME"
function Main()
? "Z" > "W" // --> .T.
return nil
function Main()
HB_SetCodePage( "TRWIN" )
? "Z" > "W" // --> .F. : This is not correct
return nil
HB_SetCodePage( "ESWIN" )
HB_LangSelect( "es" )
HB_SetCodePage( "TRWIN" )
HB_LangSelect( "tr" ) // Runtime error
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 62 guests