topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
|---|---|
Adios borland c
|
Para hacer pruebas rápidas y pequeñas aplicaciones está bien Borland pero para hacer aplicaciones más grandes y que utilicen más recursos, personalmente utilizo VS
|
Adios borland c
|
Las nuevas versiones de 64bit de BCC desde la 7.3 usan cLang. O sea la crema de la crema de compiladores C.
De hecho VC está metiendo cLang también en sus compiladores.
Desarrollador de cLang:
Apple
Microsoft
Google
ARM Holdings
Sony
Intel
Advanced Micro Devices (AMD)
Así que seguramente lo habéis probado poco.
[url:1o6xngs8]https://docs.microsoft.com/es-es/cpp/build/clang-support-msbuild?view=vs-2019[/url:1o6xngs8]
[url:1o6xngs8]https://es.wikipedia.org/wiki/Clang[/url:1o6xngs8]
Otra cosa es la version de 32 bits que es la vieja 6.00 con retoques.
Si os fijais las libs de 32 tienen extensión *.lib y la 64 *.a
Así que ya os digo que el futuro son los compiladores basados en LLVM/cLang <!-- s:twisted: --><img src="{SMILIES_PATH}/icon_twisted.gif" alt=":twisted:" title="Twisted Evil" /><!-- s:twisted: --> <!-- s:roll: --><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!-- s:roll: --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
Adir() varios tipos de ficheros (Solucionado)
|
Buenas
Para seleccionar de un directorio los archivos jpg, hacemos:
[code=fw:1y7t173k]<div class="fw" id="{CB}" style="font-family: monospace;"> Ficheros := Array<span style="color: #000000;">(</span> ADir<span style="color: #000000;">(</span> Publicas:<span style="color: #000000;">cUnidad</span>+<span style="color: #ff0000;">"*.jpg"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span></div>[/code:1y7t173k]
Pero si quiero seleccionar jpg y pdf , como lo hago?
|
Adir() varios tipos de ficheros (Solucionado)
|
Mira se ayuda:
[url:n89c9p1h]https://forums.fivetechsupport.com/viewtopic.php?f=3&t=42468&p=255377&hilit=DIRECTORYRECURSE&sid=0f1daade43d96bbf95801bdd85a5b0e0&sid=13155b273d2d9de35218742e39991594#p255377[/url:n89c9p1h]
[url:n89c9p1h]https://forums.fivetechsupport.com/viewtopic.php?f=3&t=40919&p=245088&hilit=DIRECTORYRECURSE&sid=0f1daade43d96bbf95801bdd85a5b0e0&sid=13155b273d2d9de35218742e39991594#p245088[/url:n89c9p1h]
[url:n89c9p1h]https://forums.fivetechsupport.com/viewtopic.php?f=6&t=40329&p=240871&hilit=DIRECTORYRECURSE&sid=0f1daade43d96bbf95801bdd85a5b0e0&sid=13155b273d2d9de35218742e39991594#p240871[/url:n89c9p1h]
[url:n89c9p1h]https://forums.fivetechsupport.com/viewtopic.php?f=3&t=36560&p=230666&hilit=directoryrecurse&sid=0f1daade43d96bbf95801bdd85a5b0e0&sid=13155b273d2d9de35218742e39991594#p230666[/url:n89c9p1h]
[url:n89c9p1h]https://forums.fivetechsupport.com/viewtopic.php?f=6&t=11211&p=55219&hilit=aFindFile&sid=0f1daade43d96bbf95801bdd85a5b0e0&sid=13155b273d2d9de35218742e39991594#p55219[/url:n89c9p1h]
[url:n89c9p1h]http://fivewin.com.br/index.php?/topic/20353-como-identificar-pasta-aleat%C3%A3%C2%B3ria/&tab=comments#comment-42950[/url:n89c9p1h]
Regards, saludos.
|
Adir() varios tipos de ficheros (Solucionado)
|
Otra opcion:
[code=fw:bq8ty55f]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">local</span> ficheros := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> <span style="color: #B900B9;">// Con todos los datos del fichero</span><br /> AEval<span style="color: #000000;">(</span>Directory<span style="color: #000000;">(</span><span style="color: #ff0000;">".<span style="color: #000000;">\*</span>.jpg"</span><span style="color: #000000;">)</span>, <span style="color: #000000;">{</span>|x| Aadd<span style="color: #000000;">(</span>ficheros,x<span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> AEval<span style="color: #000000;">(</span>Directory<span style="color: #000000;">(</span><span style="color: #ff0000;">".<span style="color: #000000;">\*</span>.pdf"</span><span style="color: #000000;">)</span>, <span style="color: #000000;">{</span>|x| Aadd<span style="color: #000000;">(</span>ficheros,x<span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">xbrowse</span><span style="color: #000000;">(</span>ficheros<span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">// Solo el nombre del fichero</span><br /> AEval<span style="color: #000000;">(</span>Directory<span style="color: #000000;">(</span><span style="color: #ff0000;">".<span style="color: #000000;">\*</span>.jpg"</span><span style="color: #000000;">)</span>, <span style="color: #000000;">{</span>|x| Aadd<span style="color: #000000;">(</span>ficheros,x<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> AEval<span style="color: #000000;">(</span>Directory<span style="color: #000000;">(</span><span style="color: #ff0000;">".<span style="color: #000000;">\*</span>.pdf"</span><span style="color: #000000;">)</span>, <span style="color: #000000;">{</span>|x| Aadd<span style="color: #000000;">(</span>ficheros,x<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">xbrowse</span><span style="color: #000000;">(</span>ficheros<span style="color: #000000;">)</span><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:bq8ty55f]
|
Adir() varios tipos de ficheros (Solucionado)
|
hi,
try this CODE from HMG Forum
[code=fw:2nk40tjz]<div class="fw" id="{CB}" style="font-family: monospace;"> aDir := HB_DirScanM<span style="color: #000000;">(</span> cPath, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"*.bmp"</span>, <span style="color: #ff0000;">"*.jpg"</span>, <span style="color: #ff0000;">"*.jpeg"</span>, <span style="color: #ff0000;">"*.png"</span>, <span style="color: #ff0000;">"*.gif"</span>, <span style="color: #ff0000;">"*.tif"</span>, <span style="color: #ff0000;">"*.tiff"</span>, <span style="color: #ff0000;">"*.wmf"</span>, <span style="color: #ff0000;">"*.emf"</span> <span style="color: #000000;">}</span>, <span style="color: #ff0000;">""</span>, .T. <span style="color: #000000;">)</span></div>[/code:2nk40tjz]
it can recursive get all those Image Type
[code=fw:2nk40tjz]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> hb_DirScanM<span style="color: #000000;">(</span> cPath, aFileMask, cAttr, lrecursiv <span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span> hb_DoScanM<span style="color: #000000;">(</span> hb_DirSepAdd<span style="color: #000000;">(</span> hb_defaultValue<span style="color: #000000;">(</span> cPath, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> IIF<span style="color: #000000;">(</span> HB_ISARRAY<span style="color: #000000;">(</span> aFileMask <span style="color: #000000;">)</span>, aFileMask, IIF<span style="color: #000000;">(</span> HB_ISSTRING<span style="color: #000000;">(</span> aFileMask <span style="color: #000000;">)</span>, <span style="color: #000000;">{</span> aFileMask <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span> hb_osFileMask<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, ;<br /> hb_defaultValue<span style="color: #000000;">(</span> cAttr, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span>, ;<br /> hb_ps<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, lrecursiv <span style="color: #000000;">)</span></div>[/code:2nk40tjz]
[code=fw:2nk40tjz]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> hb_doScanM<span style="color: #000000;">(</span> cPath, aMask, cAttr, cPathSep, lrecursiv <span style="color: #000000;">)</span><br /><span style="color: #00C800;">LOCAL</span> aFile<br /><span style="color: #00C800;">LOCAL</span> lMatch<br /><span style="color: #00C800;">LOCAL</span> aResult := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">DEFAULT</span> lrecursiv := .T.<br /><br /> <span style="color: #00C800;">FOR</span> EACH aFile IN hb_vfDirectory<span style="color: #000000;">(</span> cPath + hb_osFileMask<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, cAttr + <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> lrecursiv, <span style="color: #ff0000;">"D"</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> lMatch := .F.<br /> AEVAL<span style="color: #000000;">(</span> aMask, <span style="color: #000000;">{</span> | x | IIF<span style="color: #000000;">(</span> HB_ISSTRING<span style="color: #000000;">(</span> x <span style="color: #000000;">)</span>, lMatch := hb_FileMatch<span style="color: #000000;">(</span> aFile<span style="color: #000000;">[</span> F_NAME <span style="color: #000000;">]</span>, x <span style="color: #000000;">)</span> .OR. lMatch, <span style="color: #00C800;">Nil</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> <span style="color: #ff0000;">"D"</span> $ aFile<span style="color: #000000;">[</span> F_ATTR <span style="color: #000000;">]</span><br /> <span style="color: #00C800;">IF</span> lMatch .AND. <span style="color: #ff0000;">"D"</span> $ cAttr<br /> <span style="color: #00C800;">IF</span> lrecursiv = .T.<br /> AADD<span style="color: #000000;">(</span> aResult, aFile <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> !<span style="color: #000000;">(</span> aFile<span style="color: #000000;">[</span> F_NAME <span style="color: #000000;">]</span> == <span style="color: #ff0000;">"."</span> .OR. aFile<span style="color: #000000;">[</span> F_NAME <span style="color: #000000;">]</span> == <span style="color: #ff0000;">".."</span> .OR. aFile<span style="color: #000000;">[</span> F_NAME <span style="color: #000000;">]</span> == <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> AEVAL<span style="color: #000000;">(</span> hb_DoScanM<span style="color: #000000;">(</span> cPath + aFile<span style="color: #000000;">[</span> F_NAME <span style="color: #000000;">]</span> + cPathSep, aMask, cAttr, cPathSep <span style="color: #000000;">)</span>, ;<br /> <span style="color: #000000;">{</span> | x | x<span style="color: #000000;">[</span> F_NAME <span style="color: #000000;">]</span> := aFile<span style="color: #000000;">[</span> F_NAME <span style="color: #000000;">]</span> + cPathSep + x<span style="color: #000000;">[</span> F_NAME <span style="color: #000000;">]</span>, ;<br /> AADD<span style="color: #000000;">(</span> aResult, x <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> ELSEIF lMatch<br /> AADD<span style="color: #000000;">(</span> aResult, aFile <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">NEXT</span><br /><br /><span style="color: #00C800;">RETURN</span> aResult</div>[/code:2nk40tjz]
|
Adir() varios tipos de ficheros (Solucionado)
|
Muchas gracias por vuestra ayuda
|
AdjClient Adjtop...
|
Hola.
Para Antonio, creo que deberia proporcionarse los métodos de ajuste a la clase TDialog tambien. Si tenemos una Dialog CHILD es interesante que se la pueda dejar que se ajuste del mismo modo que si fuera un control.
Incluso iria un poco mas lejos, es posible que se pudiese implementar directamente desde TWindow.
Un saludo.
Paco
|
AdjClient Adjtop...
|
Paco,
Si, técnicamente se puede hacer, pero en que situación sería útil ? Puedes poner un ejemplo ? gracias.
|
AdjClient Adjtop...
|
Si,
Hay ocasiones en las que se quiere añadir una dialogo hija hecha desde recursos y que se confunda con parte de una ventana:
[img:n3htdb49]http://www.arrakis.es/~canal_five/adjust.jpg[/img:n3htdb49]
En este caso tendrías que añadir un panel a la derecha un spliter y añadir de uno en uno los controles. Si lo haces con una caja de diálogo te sale de un tiron. En este caso le hacemos que se ajuste a Top y tan ricamente.
Yo me he encontrado muchos casos en los que necesitaba ese efecto y lo he hecho a mano en el RESIZE pero creo que es mas comodo como te comento.
Un saludo
|
AdjClient Adjtop...
|
¿Qué no hace el invento? vamos que lo seguimos haciendo a mano no?
|
Adjust MDI Child size when Parent MDI was resized
|
Dear All,
How to auto resize MDI CHild Window when MDI Frame was resized?
MDI Child Window resized to client coords..
Regards,
Frances
|
Adjust MDI Child size when Parent MDI was resized
|
Dear All,
I made it like this but so slow and controls are flickering..
[code=fw:1e6ulq5k]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />oMDIFrame:<span style="color: #000000;">bResized</span> := ;<br /><span style="color: #000000;">{</span>|| AEval<span style="color: #000000;">(</span>oMDIFrame:<span style="color: #000000;">oWndClient</span>:<span style="color: #000000;">aWnd</span>,;<br /> <span style="color: #000000;">{</span>|o| <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span> !IsZoomed<span style="color: #000000;">(</span>o:<span style="color: #000000;">hWnd</span><span style="color: #000000;">)</span>, <span style="color: #000000;">(</span> o:<span style="color: #0000ff;">Move</span><span style="color: #000000;">(</span><span style="color: #000000;">0</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span>,;<br /> o:<span style="color: #000000;">nHeight</span> := oMDIFrame:<span style="color: #000000;">oWndClient</span>:<span style="color: #000000;">nHeight</span>,;<br /> o:<span style="color: #000000;">nWidth</span> := oMDIFrame:<span style="color: #000000;">oWndClient</span>:<span style="color: #000000;">nWidth</span> <span style="color: #000000;">)</span>, <span style="color: #00C800;">Nil</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> </div>[/code:1e6ulq5k]
Is there any more simplyfied than this?
Regards,
Frances
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
Hello,
is it possible, to fill a xBrowse-Cell complete with aBMP ( like a picture table ) ?
Normally at least one Char is needed.
I think it must be changed inside the class.
I would be nice, xBrowse could be used as a real picture-browser ( no text )
The color resolution of the used / tested imaged from the image-directory is very low.
Is it maybe possible to use JPG- or BMP-files with higher resolutions ?
Possible Cell-Display ?
[img:2aunqunp]http://www.pflegeplus.com/pictures/beach3.jpg[/img:2aunqunp]
Inside the Browser it works, but doesn't fill the cell completely.
[img:2aunqunp]http://www.pflegeplus.com/pictures/beach5.jpg[/img:2aunqunp]
There was a possible xBrowse-solution, I have done for Silvio to display images on Mouseclick inside a cell.
I can show any Backgrounds and display a Cell-Bmp on top of it.
I want to use something like that inside my own application.
For a graphic-software, I need to show small scanned portraits of students, belonging to a school-class.
With a double-click on a cell, I open a file-list from a directory with all students-pictures to select a picture.
Each class is displayed with a extra browser. For a 3D-effect, I included a xBrowse-Shadow.
The final version will have two folderpages :
1. Page the Browser
2. Page shows Detail-informations of the student of the selected cell.
The first solution ( Silvio )
[img:2aunqunp]http://www.pflegeplus.com/pictures/beach2.jpg[/img:2aunqunp]
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
Hi Uwe
Your project sounds useful for my sons school.
Just a thought...I thought BMP's can be adjusted to fit a frame.
Long time since I experimented with them.
The display of native JPG's would be better though.
I can't help at the moment, maybe someone else can help you.
When you have sorted out the problems please let me know.
Best wishes
Jonathan Hodder
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
Hello Uwe
[quote:2504nmxd]is it possible, to fill a xBrowse-Cell complete with aBMP ( like a picture table ) ?[/quote:2504nmxd]
yes, please try with this columns data lBmpStretch and set "true"
oBrw:aCols[ 1 ]:lBmpStretch := .t.
[quote:2504nmxd]Is it maybe possible to use JPG- or BMP-files with higher resolutions ?[/quote:2504nmxd]yes, see my post in spanish forum
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?p=76565#p76565">viewtopic.php?p=76565#p76565</a><!-- l -->
this explain how paint jpg and other imagen format in xbrowse
[quote:2504nmxd]With a double-click on a cell, I open a file-list from a directory with all students-pictures to select a picture.
[/quote:2504nmxd]
i 'm thinking for other case, i hope have answer soon
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
Hello Daniel,
I did some tests, but it doesn't work with other formats.
With BMP it is ok. Freeimage is included because i use a JPG-Logo on Main-Screen and that works.
Test.jpg is shown as logo on Screen for a test ( size 50 x 50 ).
hBitmap = FILoadImg( AllTrim( "Test.jpg" ) )
if Upper( cFileExt( cFile ) ) = "BMP"
return ReadBitmap( 0, cFile )
endif
67 [color=#FF0000:2bzzuve7]nFormat = FIGETFILETYPE( cFile, 0 )[/color:2bzzuve7]
Application
===========
Path and name: D:\_TEST\testxbrw.exe (32 bits)
Size: 1,779,712 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 03/09/09, 10:06:26
Error description: Error BASE/1099 Argument error: STR
Args:
[ 1] = U
[ 2] = U
[ 3] = U
Stack Calls
===========
Called from: => STR(0)
Called from: .\source\classes\IMAGE.PRG => FIGETFILETYPE(0)
Called from: .\testxbrw.PRG => FILOADIMG(67)
Called from: .\testxbrw.PRG => MAIN(20)
It seems only BMP is accepted.
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
hello Uwe
do you have this line on the end of file?
please download the test
[url:l20vnekr]http://www.sitasoft.com/fivewin/test/testximg.rar[/url:l20vnekr]
[code=fw:l20vnekr]<div class="fw" id="{CB}" style="font-family: monospace;">DLL32 <span style="color: #00C800;">FUNCTION</span> FIGETFILETYPE<span style="color: #000000;">(</span> cFileName AS LPSTR, nSize AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_GetFileType@8"</span> LIB hLib<br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FILOAD<span style="color: #000000;">(</span> nFormat AS LONG, cFileName AS LPSTR, nFlags AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_Load@12"</span> LIB hLib<br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIGETINFOHEADER<span style="color: #000000;">(</span> hDib AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_GetInfoHeader@4"</span> LIB hLib<br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> CREATEDIBITMAP<span style="color: #000000;">(</span> hDC AS LONG, hInfoH AS LONG, nFlags AS LONG, hBits AS LONG, hInfo AS LONG, nUsage AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"CreateDIBitmap"</span> LIB <span style="color: #ff0000;">"gdi32.dll"</span><br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIGETINFO<span style="color: #000000;">(</span> hDib AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_GetInfo@4"</span> LIB hLib<br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIGETBITS<span style="color: #000000;">(</span> hDib AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_GetBits@4"</span> LIB hLib<br /> <br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIUNLOAD<span style="color: #000000;">(</span> hDib AS LONG <span style="color: #000000;">)</span> AS VOID ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_Unload@4"</span> LIB hLib</div>[/code:l20vnekr]
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
Hello Daniel,
I didn't include the DLL-functions, because they are defined
in class TIMAGE.prg.
I added them to the test and it works fine now.
But why do we need them to define twice ?
I still have to figure out, to display a Image without text inside a cell.
( a column with only images )
There is a new FREEIMAGE-version I tested with :
new size 2.084.864 / 27.07.2008
It works without problems.
Thank You
Best Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
[quote:23dpa7we]But why do we need them to define twice ?
[/quote:23dpa7we]
i think are private function
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
Hello Daniel,
Your solution works fine. The basics are done, but there is still much to do.
Because in the future, I will work with a database, I added a dynamic-bmp-list.
There will be a "blanc" picture added to the array, if a picture is missing.
Each person will have a picture-number.
The picture-name in the picture-directory will be [color=#FF0000:2q7vxfzb]"Picture" + alltrim((database)->NO)) + ".jpg"[/color:2q7vxfzb]
There will be a index on < Picture-Number > in the database, to build the array for xbrowse.
[img:2q7vxfzb]http://www.pflegeplus.com/pictures/picturebrow1.jpg[/img:2q7vxfzb]
[code=fw:2q7vxfzb]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"xbrowse.ch"</span><br /><br />REQUEST DBFCDX<br /><span style="color: #00C800;">STATIC</span> hLib<br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">local</span> oDlg<br /><span style="color: #00C800;">local</span> oBrw<br /><span style="color: #00C800;">local</span> nI<br /><span style="color: #00C800;">local</span> hBitMap := <span style="color: #000000;">{</span><span style="color: #000000;">}</span> <span style="color: #B900B9;">// Bitmap-object defined as array</span><br /><span style="color: #00C800;">local</span> aArray:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /><span style="color: #00C800;">for</span> nI = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">10</span><br /> aadd<span style="color: #000000;">(</span> aArray, <span style="color: #000000;">{</span> nI,;<br /> <span style="color: #ff0000;">"Row:"</span>+StrZero<span style="color: #000000;">(</span>nI,<span style="color: #000000;">2</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">" Col: 02"</span>,;<br /> <span style="color: #ff0000;">"Row:"</span>+StrZero<span style="color: #000000;">(</span>nI,<span style="color: #000000;">2</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">" Col: 03"</span>,;<br /> <span style="color: #ff0000;">"Row:"</span>+StrZero<span style="color: #000000;">(</span>nI,<span style="color: #000000;">2</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">" Col: 04"</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">next</span> <br /><br />hLib := LoadLibrary<span style="color: #000000;">(</span> <span style="color: #ff0000;">"freeimage.dll"</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">// dynamic image-defines</span><br />i := <span style="color: #000000;">1</span><br /><span style="color: #00C800;">FOR</span> i := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">4</span> <span style="color: #B900B9;">// will be reccount() with a database</span><br /> xxx := LTRIM<span style="color: #000000;">(</span>STR<span style="color: #000000;">(</span>i<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> AADD<span style="color: #000000;">(</span> hBitmap, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"cara"</span> + xxx + <span style="color: #ff0000;">".jpg"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> hBitmap<span style="color: #000000;">[</span>i<span style="color: #000000;">]</span> = FILoadImg<span style="color: #000000;">(</span> AllTrim<span style="color: #000000;">(</span> <span style="color: #ff0000;">"cara"</span> + xxx + <span style="color: #ff0000;">".jpg"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">NEXT</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">title</span> <span style="color: #ff0000;">"TEST"</span> <span style="color: #0000ff;">size</span> <span style="color: #000000;">800</span>,<span style="color: #000000;">600</span><br /><br />@ <span style="color: #000000;">0</span>,<span style="color: #000000;">0</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">OF</span> oDlg columns <span style="color: #000000;">{</span><span style="color: #000000;">1</span>,<span style="color: #000000;">2</span>,<span style="color: #000000;">3</span>,<span style="color: #000000;">4</span><span style="color: #000000;">}</span>;<br />Array aArray sizes <span style="color: #000000;">{</span><span style="color: #000000;">300</span>,<span style="color: #000000;">100</span>,<span style="color: #000000;">100</span>,<span style="color: #000000;">100</span><span style="color: #000000;">}</span> LINES CELL <br /><br />oBrw:<span style="color: #000000;">nMarqueeStyle</span> := <span style="color: #000000;">0</span><br /><br /><span style="color: #B900B9;">// dynamic image-settings</span><br />i := <span style="color: #000000;">1</span><br /><span style="color: #00C800;">FOR</span> i := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">4</span> <span style="color: #B900B9;">// will be recount() with a database</span><br /> xxx := LTRIM<span style="color: #000000;">(</span>STR<span style="color: #000000;">(</span>i<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">AddBmpHandle</span><span style="color: #000000;">(</span> hBitmap<span style="color: #000000;">[</span>i<span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">nRowHeight</span> := nBmpHeight<span style="color: #000000;">(</span> hBitmap<span style="color: #000000;">[</span>i<span style="color: #000000;">]</span> <span style="color: #000000;">)</span> + <span style="color: #000000;">2</span><br /><span style="color: #00C800;">NEXT</span><br />oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">lBmpStretch</span> := .t.<br />oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">nWidth</span> := <span style="color: #000000;">100</span><br />oBrw:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">bBmpData</span> := <span style="color: #000000;">{</span>|| oBrw:<span style="color: #000000;">aRow</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #000000;">}</span><br /><br /><span style="color: #B900B9;">// Maybe possible, to change the image from a image-list ???</span><br />oBrw:<span style="color: #000000;">bLClicked</span> := <span style="color: #000000;">{</span> | nRow, nCol | nArrayPos := oBrw:<span style="color: #000000;">nRowSel</span>, msgalert<span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">nAt</span>, nArrayPos <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <br /><br />oDlg:<span style="color: #000000;">oClient</span> := oBrw<br /> <br />oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> oDlg:<span style="color: #000000;">Resize</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />FreeLibrary<span style="color: #000000;">(</span> hLib <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span> <br /><br /><span style="color: #B900B9;">// ---------------------------</span><br /><br /><span style="color: #00D7D7;">#define</span> CBM_INIT <span style="color: #000000;">4</span><br /><span style="color: #00D7D7;">#define</span> DIB_RGB_COLORS <span style="color: #000000;">0</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> FILOADIMG<span style="color: #000000;">(</span> cFile <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">local</span> nFormat, hDib, hInfoH, hInfo, hBits, hWnd, hDC, hBmp<br /><br /><span style="color: #00C800;">if</span> Upper<span style="color: #000000;">(</span> cFileExt<span style="color: #000000;">(</span> cFile <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> = <span style="color: #ff0000;">"BMP"</span><br /> <span style="color: #00C800;">return</span> ReadBitmap<span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, cFile <span style="color: #000000;">)</span><br /><span style="color: #00C800;">endif</span><br /><br />nFormat = FIGETFILETYPE<span style="color: #000000;">(</span> cFile, <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br />hDib = FILOAD<span style="color: #000000;">(</span> nFormat, cFile, <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br />hInfoH = FIGETINFOHEADER<span style="color: #000000;">(</span> hDib <span style="color: #000000;">)</span><br />hInfo = FIGETINFO<span style="color: #000000;">(</span> hDib <span style="color: #000000;">)</span><br />hBits = FIGETBITS<span style="color: #000000;">(</span> hDib <span style="color: #000000;">)</span><br />hWnd = GETDESKTOPWINDOW<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />hDC = GETDC<span style="color: #000000;">(</span> hWnd <span style="color: #000000;">)</span><br /><br />hBmp = CreateDiBitmap<span style="color: #000000;">(</span> hDC, hInfoH, CBM_INIT, hBits, hInfo, DIB_RGB_COLORS <span style="color: #000000;">)</span><br /><br />ReleaseDC<span style="color: #000000;">(</span> hWnd, hDC <span style="color: #000000;">)</span><br /><br />FIUNLOAD<span style="color: #000000;">(</span> hDib <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> hBmp<br /><br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIGETFILETYPE<span style="color: #000000;">(</span> cFileName AS LPSTR, nSize AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_GetFileType@8"</span> LIB hLib<br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FILOAD<span style="color: #000000;">(</span> nFormat AS LONG, cFileName AS LPSTR, nFlags AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_Load@12"</span> LIB hLib<br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIGETINFOHEADER<span style="color: #000000;">(</span> hDib AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_GetInfoHeader@4"</span> LIB hLib<br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> CREATEDIBITMAP<span style="color: #000000;">(</span> hDC AS LONG, hInfoH AS LONG, nFlags AS LONG, hBits AS LONG, hInfo AS LONG, nUsage AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"CreateDIBitmap"</span> LIB <span style="color: #ff0000;">"gdi32.dll"</span><br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIGETINFO<span style="color: #000000;">(</span> hDib AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_GetInfo@4"</span> LIB hLib<br /><br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIGETBITS<span style="color: #000000;">(</span> hDib AS LONG <span style="color: #000000;">)</span> AS LONG ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_GetBits@4"</span> LIB hLib<br /> <br />DLL32 <span style="color: #00C800;">FUNCTION</span> FIUNLOAD<span style="color: #000000;">(</span> hDib AS LONG <span style="color: #000000;">)</span> AS VOID ;<br /> PASCAL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"_FreeImage_Unload@4"</span> LIB hLib<br /><br /> </div>[/code:2q7vxfzb]
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
Adjust a Bmp to a xBrowse-Cell-Grid ?
|
Hi Uwe
Looks promising,
[quote:3svrbd7i]With a double-click on a cell, I open a file-list from a directory with all students-pictures to select a picture.[/quote:3svrbd7i]
Possibly a drag and drop!
[quote:3svrbd7i]There will be a index on < Picture-Number > in the database, to build the array for xbrowse.[/quote:3svrbd7i]
Do you intend to rename the <Picture-Number>?
What about date the picture was taken - cameras automatically allocate a number to the next picture taken.
Maybe the picture directory name will contain the year.
An option is to index on the data file - Student Class - and have a field in this student data
file containing the <Picture-Number> to fill the array.
Useful stuff.
Jonathan
|
Adjust dialogs and controls automatic
|
<!-- m --><a class="postlink" href="http://www.fivewin.com.br/forum/topic.asp?TOPIC_ID=17683">http://www.fivewin.com.br/forum/topic.a ... C_ID=17683</a><!-- m -->
In this topic of the Brazilian forum a user posted a function that adjust the dialogs and controls to fit the resolution of the user, I think that this will be a great add to the Fivewin, so with this we have just to set the resolution where we develop the resource(Workshop, Pelles)...
|
Adjust in TGif class Linares
|
Linares, could you take a look in the TGif class to adapt it to use images from resource and can be defined in a dialog?
|
Adjust in TGif class Linares
|
Samir,
We are working on an enhanced Class TGif that supports all GIF different formats, besides your requirements <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
Adjust in TGif class Linares
|
I hope I can test something soon....
|
Adjust the width of Excel cell
|
I am trying to export the data of a recordset to excel sheet .I want to adjust the cell width of a particular cell,How can i do it.Following is my code.
[code=fw:255zbdnp]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//------------------------------------------------------------------------------</span><br /><span style="color: #00C800;">FUNCTION</span> ExportToExcel<span style="color: #000000;">(</span>oRecSet<span style="color: #000000;">)</span><br /><span style="color: #B900B9;">//------------------------------------------------------------------------------</span><br /> <span style="color: #00C800;">LOCAL</span> oExcel ,oBook,oSheet<br /> <span style="color: #00C800;">LOCAL</span> j, i ,cFormat<br /><br /> <span style="color: #00C800;">TRY</span><br /> oExcel := CreateObject<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Excel.Application"</span> <span style="color: #000000;">)</span><br /> oBook := oExcel:<span style="color: #000000;">Workbooks</span>:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oSheet := oBook:<span style="color: #000000;">Worksheets</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> CATCH<br /> MsgBox<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Excel not installed"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span><br /> END<br /> oRecSet:<span style="color: #000000;">movefirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> CreateExcelHeader<span style="color: #000000;">(</span>@oExcel,oRecSet<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">FOR</span> J:=<span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> oRecSet:<span style="color: #000000;">RecordCount</span><br /><br /><br /> <span style="color: #00C800;">FOR</span> K:=<span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> oRecSet:<span style="color: #000000;">Fields</span>:<span style="color: #000000;">Count</span><span style="color: #000000;">-1</span><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br /> <span style="color: #00C800;">CASE</span> ValType<span style="color: #000000;">(</span>oRecSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> K <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span> == <span style="color: #ff0000;">'N'</span><br /> oExcel:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span>J<span style="color: #000000;">+1</span>, k<span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>:=oRecSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> K <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><br /> cFormat := <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> .F., <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> .T., <span style="color: #ff0000;">"#,##0"</span>, <span style="color: #ff0000;">"#.##0"</span> <span style="color: #000000;">)</span>, <span style="color: #ff0000;">"0"</span> <span style="color: #000000;">)</span><br /> oSheet:<span style="color: #000000;">Columns</span><span style="color: #000000;">(</span> k<span style="color: #000000;">)</span>:<span style="color: #000000;">NumberFormat</span> :=cFormat<br /> <span style="color: #00C800;">CASE</span> ValType<span style="color: #000000;">(</span>oRecSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> K <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span> == <span style="color: #ff0000;">'D'</span><br /> oExcel:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span>J<span style="color: #000000;">+1</span>, k<span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>:=AllTrim<span style="color: #000000;">(</span>MySqlDateFormat<span style="color: #000000;">(</span>oRecSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> K <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> oSheet:<span style="color: #000000;">Columns</span><span style="color: #000000;">(</span> k<span style="color: #000000;">)</span>:<span style="color: #000000;">NumberFormat</span> := Lower<span style="color: #000000;">(</span> Set<span style="color: #000000;">(</span> _SET_DATEFORMAT <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">OTHERWISE</span><br /> oExcel:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span>J<span style="color: #000000;">+1</span>, k<span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>:=oRecSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> K <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><br /> <span style="color: #00C800;">ENDCASE</span><br /><br /> <span style="color: #00C800;">NEXT</span><br /> oRecSet:<span style="color: #000000;">moveNext</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">NEXT</span><br /> oSheet:<span style="color: #000000;">Range</span><span style="color: #000000;">(</span> oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>, oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>,oRecSet:<span style="color: #000000;">Fields</span>:<span style="color: #0000ff;">Count</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span>:<span style="color: #0000ff;">Font</span>:<span style="color: #000000;">Bold</span> = .T.<br /> oSheet:<span style="color: #000000;">Range</span><span style="color: #000000;">(</span>oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>, oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>,oRecSet:<span style="color: #000000;">Fields</span>:<span style="color: #0000ff;">Count</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span>:<span style="color: #0000ff;">Select</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oExcel:<span style="color: #000000;">Selection</span>:<span style="color: #000000;">Borders</span><span style="color: #000000;">(</span><span style="color: #000000;">9</span><span style="color: #000000;">)</span>:<span style="color: #000000;">LineStyle</span> := <span style="color: #000000;">1</span><br /> oExcel:<span style="color: #000000;">Selection</span>:<span style="color: #000000;">Borders</span><span style="color: #000000;">(</span><span style="color: #000000;">9</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Weight</span> := <span style="color: #000000;">4</span><br /> oExcel:<span style="color: #000000;">Visible</span> = .T.<br /><br /> oBook := <span style="color: #00C800;">Nil</span><br /> oSheet := <span style="color: #00C800;">Nil</span><br /> oExcel := <span style="color: #00C800;">Nil</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">Nil</span><br /><span style="color: #B900B9;">//------------------------------------------------------------------------------</span><br /><span style="color: #00C800;">FUNCTION</span> CreateExcelHeader<span style="color: #000000;">(</span>oExcel,oRecSet<span style="color: #000000;">)</span><br /><span style="color: #B900B9;">//------------------------------------------------------------------------------</span><br /><br /> <span style="color: #00C800;">LOCAL</span> Kcnt<br /> <span style="color: #00C800;">FOR</span> Kcnt:=<span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> oRecSet:<span style="color: #000000;">Fields</span>:<span style="color: #000000;">Count</span><span style="color: #000000;">-1</span><br /> oExcel:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span>, Kcnt<span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>:=oRecSet:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> Kcnt <span style="color: #000000;">)</span>:<span style="color: #0000ff;">Name</span><br /> <span style="color: #00C800;">NEXT</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">Nil</span><br /><br /><br /> </div>[/code:255zbdnp]
|
Adjust the width of Excel cell
|
Dear Mr.Sajith,
[code=fw:y6zn5itm]<div class="fw" id="{CB}" style="font-family: monospace;">oExcel := CreateObject<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Excel.Application"</span> <span style="color: #000000;">)</span><br />oBook := oExcel:<span style="color: #000000;">WorkBooks</span>:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oSheet := oExcel:<span style="color: #000000;">ActiveSheet</span><br />oSheet:<span style="color: #000000;">Columns</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">ColumnWidth</span>:=<span style="color: #000000;">20</span></div>[/code:y6zn5itm]
Regards
Anser
|
Adjust the width of Excel cell
|
Dear Anser,
Thanks for ur Replay.Its Works Fine
regards sajith
|
Adjusting alignment in Excel
|
Hello,
How can I adjust the alignment of a cel, some cells, columns or rows in FWH for Excel?
Thanks.
|
Adjusting alignment in Excel
|
[code=fw:63ti9iqe]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oExcel := CreateObject<span style="color: #000000;">(</span> <span style="color: #ff0000;">"excel.application"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oBook := oExcel:<span style="color: #000000;">Workbooks</span>:<span style="color: #000000;">Add</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oSheet := oBook:<span style="color: #000000;">Worksheets</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <br /><br /> oSheet:<span style="color: #000000;">Range</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"A1"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = <span style="color: #ff0000;">"Last Name"</span><br /> oSheet:<span style="color: #000000;">Range</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"B1"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = <span style="color: #ff0000;">"First Name"</span><br /> oSheet:<span style="color: #000000;">Range</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"A1:B1"</span> <span style="color: #000000;">)</span>:<span style="color: #0000ff;">Font</span>:<span style="color: #000000;">Bold</span> = .T.<br /> <br /> oSheet:<span style="color: #000000;">Range</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"A2"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = <span style="color: #ff0000;">"Doe"</span><br /> oSheet:<span style="color: #000000;">Range</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"B2"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> = <span style="color: #ff0000;">"John"</span><br /><br /> oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">5</span>, <span style="color: #000000;">1</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := <span style="color: #ff0000;">"Left Alignment"</span><br /> oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">6</span>, <span style="color: #000000;">1</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := <span style="color: #ff0000;">"Cente Alignment"</span><br /> oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">7</span>, <span style="color: #000000;">1</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := <span style="color: #ff0000;">"Right Alignment"</span><br /> <br /> <span style="color: #B900B9;">//&& 4 for Right Alignment, 3 for Center and 2 for Left </span><br /> <br /> oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">5</span>, <span style="color: #000000;">1</span><span style="color: #000000;">)</span>:<span style="color: #000000;">HorizontalAlignment</span> := <span style="color: #000000;">4</span> <br /> oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">6</span>, <span style="color: #000000;">1</span><span style="color: #000000;">)</span>:<span style="color: #000000;">HorizontalAlignment</span> := <span style="color: #000000;">3</span> <br /> oSheet:<span style="color: #000000;">Cells</span><span style="color: #000000;">(</span><span style="color: #000000;">7</span>, <span style="color: #000000;">1</span><span style="color: #000000;">)</span>:<span style="color: #000000;">HorizontalAlignment</span> := <span style="color: #000000;">2</span> <br /> <br /> oBook:<span style="color: #000000;">SaveAs</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"C:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\s</span>amples<span style="color: #000000;">\B</span>ook1.xls"</span> <span style="color: #000000;">)</span> <br /> oExcel:<span style="color: #000000;">Visible</span> = .T.<br /><br /> <span style="color: #B900B9;">// oExcel:Quit() </span><br /><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ok"</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> <br /> </div>[/code:63ti9iqe]
|
Adjusting alignment in Excel
|
Thanks a lot for your help.
|
Adjusting alignment in Excel
|
Hello,
You can define as well:
# DEFINE xlHAlignGeneral 1
# DEFINE xlHAlignLeft -4131
# DEFINE xlHAlignCenter -4108
# DEFINE xlHAlignRight -4152
# DEFINE xlHAlignJustify -4130
# DEFINE xlVAlignBottom -4107
# DEFINE xlVAlignTop -4160
# DEFINE xlVAlignCenter -4108
# DEFINE xlVAlignJustify -4130
oAs:Range ('A1:O1'):Merge()
oAs:Cells (nRow, 1):HorizontalAlignment = xlHAlignCenter
oAs:Cells (nRow, 1):Font:Bold := .T.
oAs:Cells (nRow, 1):Font:Size := 12
oAs:Cells (nRow, 1):Value := PA[11]
// Shading...
oAs:Range ('A'+LTRIM(STR(nRow))+':O'+LTRIM(STR(nRow))):Interior:ColorIndex = 17
here is website for color codes: [url:2s4ra8j8]http://dmcritchie.mvps.org/excel/colors.htm[/url:2s4ra8j8]
// Alignment...
oAs:Range ('C'+LTRIM(STR(nRow))+':C65536'):HorizontalAlignment = xlHAlignCenter
oAs:Range ('M'+LTRIM(STR(nRow))+':M65536'):HorizontalAlignment = xlHAlignRight
oAs:Range ('K'+LTRIM(STR(nRow))+':K65536'):NumberFormat = '###,###,###.00'
|
Adjusting the IDE windows height
|
Adjusting the IDE windows to the new Windows 7 taskbar height (and all other Windows versions taskbars):[url=http://imageshack.us:tsqagtz9][img:tsqagtz9]http://img98.imageshack.us/img98/2811/iders7.png[/img:tsqagtz9][/url:tsqagtz9]
|
Administración de Memoría
|
Buenas a Todos!Antes que nada les felicito a todos he visto cosas interesantes en el foro!, como se darán cuenta soy nuevo por aca.Bueno ahora lo importante y que me preocupa, estoy realizando una aplicación Administrativa con FW.6.12 y xharbour y BCC55 utilizando xmate para compilar, usando Pelles para mis recurso, en donde genere unas clases en las que se basa, pero observo con preocupación que la memoría se va incrementando cada que mando llamar mis clases, como referencia, ya me encarge de eliminar los objetos creados por medio del deleteobject, asegurandome de que esto fue realizado, verificando el resultado de la variable verdadera. Sin embargo no veo que la memoría disminuya.Por otra parte observo algo muy curioso al minimizar la ventana principal y restaurarla la memoría se recupera.Alguien me podría dar una idea de como perfeccionar la administración de memoría.De antemano Gracias!!
|
Administración de Memoría
|
Bienvenido! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->FWH llama al "recolector de basura" de Harbour cuando sale de una caja de diálogo. Si realizas tareas que consuman memoria y en las que no uses diálogos, entonces llama a hb_gcAll() de vez en cuando para que se limpie la memoria usada que ya no es necesaria.
|
Administración de Memoría
|
Si vi el colector, y de hecho me llama la atención porque se encuentra en el momento de terminar un dialogo, pero no una ventana, ¿ Tiene eso algún motivo en especial?, Porque mencionas solo utilizarlo de vez en cuando y no utlizarlo por decir al concluir la clase.Es bueno contar con apoyo de este estilo, creo saber por donde va mi situación, haré unas pruebas y les informare el resultado.Gracias!!
|
Administración de Memoría
|
En una aplicacion "tradicional" las cajas de dialogo son el elemento mas usado pues es donde el usuario interacciona con la aplicacion, de ahi que sea un buen momento -en la salida- para llamar al recolector de basuras. Eso no quiere decir que puedan existir excepciones.El proceso de recoleccion de basura es un proceso que consume tiempo y ejecuta bastantes subprocesos, luego no es conveniente estar llamandolo constantemente. De hecho no pasa nada porque la aplicacion haya consumido una determinada cantidad de memoria, lo importante es que esa memoria la liberemos y no la vayamos acumulando.
|
Administración de Memoría
|
Ha sido de utilidad estos comentarios.Por otra parte, me interesaría conocerte personalmente y mostrarte la locura que ando haciendo, y ver de que forma podría contar con una asesoría especifica.Como referencia me imagino que has de ubicar a Ignacio Vizcaíno, yo durante casi 15 años he estado pegado a sus desarrollos y me han parecido muy intersantes y hoy en día llevo aproximadamente un año, haciendo algo similar.Me imagino que eso te puede servir de referencia para comprender porque el consumo de memoria, jejejjeeDe cualquier forma Gracias por tu ayuda
|
Administrado de Proyectos
|
Hola, buen día.
Yo usaba xMate para crear mis proyectos. Ahora con FW64 y VS2011 tengo un incoveniente al declarar las rutas de include.
Me pueden sugerir algún otro gestor de recursos.
Saludos.
Por cierto el problema que tengo con xMate es el siguiente, el separador " ; " me marca un error .
C:\fwh64.1311\VC\Bin\cl.Exe -TC -W3 -O2 -c -IC:\fwh64.1311\include;c:\hb30\Include C:\fwh64.1311\samples\Obj\testbrow.c
La solución que apliqué fue la siguiente : C:\fwh64.1311\VC\Bin\cl.Exe -TC -W3 -O2 -c [b:2wuikgh6]-I[/b:2wuikgh6]C:\fwh64.1311\include [b:2wuikgh6]-I[/b:2wuikgh6]c:\hb30\Include C:\fwh64.1311\samples\Obj\testbrow.c
Sin embargo al crear el executable, xMate "incluye" el " ; "
|
Administrado de Proyectos
|
Problema relacionado con ";" ... resuelto.
Gracias <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
Administrador en Win Vista Bussines
|
Amigos:
Como hago para ingresar a WinVista Bussines como adminstrador
Muchas gracias
Ruben Fernandez
|
Administrador en Win Vista Bussines
|
Ruben,
Pulsa el botón derecho del ratón sobre "Mi ordenador" y selecciona "Administrar". Desde ahí ve a la gestión de usuarios y activa la cuenta del administrador que por defecto esta desactivada.
Yo lo uso en inglés por lo que no puedo decirte los textos exactos en español. Pero es desde ahi desde donde debes activar el administrador.
Luego cambias de usuario y entras como administrador
|
Administrador en Win Vista Bussines
|
Gracias Maestro.
Saludos
Ruben Fernandez
|
Administrar tablas MySql/MaDB embedded
|
Estimados
Con cual herramienta se puede hacer, he intentado con HeidiSql y no veo como.
ó cómo agregar tablas a la base sacadas de un motor.
Gracias por la ayuda.
|
Administrar tablas MySql/MaDB embedded
|
Adhemar:
Por qué no lo haces desde código?
Saludos
|
Administrar tablas MySql/MaDB embedded
|
[quote="Armando":9r683sbv]Adhemar:
Por qué no lo haces desde código?
Saludos[/quote:9r683sbv]
Armando,
Puedes poner un ejemplo?
|
Administrar tablas MySql/MaDB embedded
|
Muchas Gracias por contestar y sus sugerencias.
Quería evitar la creada de las tablas y el posterior llenado con datos ya existentes.
Claro que también es necesario poder administrarlas
|
Administrar tablas MySql/MaDB embedded
|
Adhemar:
Ahora entiendo tu necesidad, lo quieres es copiar una tabla que ya existe con datos en una base x
a otra base de datos, esto será por única vez. es así?
Si es así, es mejor un administrador de bases de datos.
Saludos
|
Administrar tablas MySql/MaDB embedded
|
Compuin:
Mi recomendación era para crear la base de datos y la o las tablas vacías desde
código y también por código dar mantenimiento, agregar registros.
Si buscas código para esto con gusto lo pongo.
Saludos
|
Administrar tablas MySql/MaDB embedded
|
[quote="Armando":38055qnl]Compuin:
Mi recomendación era para crear la base de datos y la o las tablas vacías desde
código y también por código dar mantenimiento, agregar registros.
Si buscas código para esto con gusto lo pongo.
Saludos[/quote:38055qnl]
Gracias Armando,
Podrias poner un codigo para ABM (Agregar, Borrar, Modificar)?
|
Administrar tablas MySql/MaDB embedded
|
Compuin:
Debo anticiparte que solo uso ADO, FW y xHarbour.
[code=fw:2nqb5ik2]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// Creamos la Base de Datos si es que no existe ya</span><br />cCmdSql := <span style="color: #ff0000;">"CREATE DATABASE IF NOT EXISTS "</span> + ALLTRIM<span style="color: #000000;">(</span>oApp:<span style="color: #000000;">cDataBase</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">TRY</span><br /> oApp:<span style="color: #000000;">oCon</span>:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span>cCmdSql<span style="color: #000000;">)</span><br />CATCH oError<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"No se pudo crear la base de datos !"</span>,oApp:<span style="color: #000000;">cAplicacion</span><span style="color: #000000;">)</span><br /> ShowError<span style="color: #000000;">(</span>oError<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br />END<br /> </div>[/code:2nqb5ik2]
Le seguimos?
Saludos
|
Administrar tablas MySql/MaDB embedded
|
[quote="Armando":2012phug]Compuin:
Debo anticiparte que solo uso ADO, FW y xHarbour.
[code=fw:2012phug]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// Creamos la Base de Datos si es que no existe ya</span><br />cCmdSql := <span style="color: #ff0000;">"CREATE DATABASE IF NOT EXISTS "</span> + ALLTRIM<span style="color: #000000;">(</span>oApp:<span style="color: #000000;">cDataBase</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">TRY</span><br /> oApp:<span style="color: #000000;">oCon</span>:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span>cCmdSql<span style="color: #000000;">)</span><br />CATCH oError<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"No se pudo crear la base de datos !"</span>,oApp:<span style="color: #000000;">cAplicacion</span><span style="color: #000000;">)</span><br /> ShowError<span style="color: #000000;">(</span>oError<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br />END<br /> </div>[/code:2012phug]
Le seguimos?
Saludos[/quote:2012phug]
Gracias. Si, adelante
|
Administrar tablas MySql/MaDB embedded
|
Ahora creamos una tabla
[code=fw:13t8o9q2]<div class="fw" id="{CB}" style="font-family: monospace;"><br />cCmdSql := <span style="color: #ff0000;">"CREATE TABLE IF NOT EXISTS Bancos ("</span> +;<br /> <span style="color: #ff0000;">"BAN_CIA DECIMAL(02,0) NOT NULL DEFAULT 0 COMMENT 'Número de compañia',"</span> +;<br /> <span style="color: #ff0000;">"BAN_BAN DECIMAL(03,0) NOT NULL DEFAULT 0 COMMENT 'Número de banco',"</span> +; <span style="color: #B900B9;">// Versión 3.0M00</span><br /> <span style="color: #ff0000;">"BAN_NOM CHAR(30) NOT NULL DEFAULT '' COMMENT 'Nombe del banco',"</span> +;<br /> <span style="color: #ff0000;">"BAN_USU CHAR(15) NOT NULL DEFAULT '' COMMENT 'Usuario que actualizó',"</span> +;<br /> <span style="color: #ff0000;">"BAN_FDC DATE NOT NULL DEFAULT '0000-00-00' COMMENT 'Fecha de actualización',"</span> +;<br /> <span style="color: #ff0000;">"BAN_HRA TIME NOT NULL DEFAULT '00:00:00' COMMENT 'Hora de actualización',"</span> +;<br /> <span style="color: #ff0000;">"PRIMARY KEY(BAN_CIA,BAN_BAN))"</span> +;<br /> <span style="color: #ff0000;">"ENGINE = InnoDB COMMENT 'Bancos';"</span><br /><br /><span style="color: #00C800;">TRY</span><br /> oApp:<span style="color: #000000;">oCon</span>:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span>cCmdSql<span style="color: #000000;">)</span><br />CATCH oError<br /> MsgStop<span style="color: #000000;">(</span><span style="color: #ff0000;">"La tabla BANCOS NO pudo ser creada !"</span>,oApp:<span style="color: #000000;">cAplicacion</span><span style="color: #000000;">)</span><br /> ShowError<span style="color: #000000;">(</span>oError<span style="color: #000000;">)</span><br />END<br /> </div>[/code:13t8o9q2]
Vea el siguiente capítulo
|
Administrar tablas MySql/MaDB embedded
|
Ok
|
Administrar tablas MySql/MaDB embedded
|
Ahora mantenimiento
[code=fw:3ao3zndz]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #00C800;">IF</span> lAppend<br /> oRsBan:<span style="color: #000000;">AddNew</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> oRsBan:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BAN_CIA"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := oApp:<span style="color: #000000;">nNumCia</span><br /> oRsBan:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BAN_BAN"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := oBan:<span style="color: #000000;">BAN</span><br /> oRsBan:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BAN_NOM"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := oBan:<span style="color: #000000;">NOM</span><br /> oRsBan:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BAN_USU"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := <span style="color: #0000ff;">LEFT</span><span style="color: #000000;">(</span>ALLTRIM<span style="color: #000000;">(</span>oApp:<span style="color: #000000;">cUsuario</span><span style="color: #000000;">)</span>,<span style="color: #000000;">15</span><span style="color: #000000;">)</span><br /> oRsBan:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BAN_FDC"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := DATE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRsBan:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"BAN_HRA"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := TIME<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRsBan:<span style="color: #0000ff;">UpDate</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:3ao3zndz]
Desde luego hay que determinar si lo que quieres es Agregar o Modificar, para eso utilizo
la variable lAppend
También hace falta todo el código para la edición de los datos.
Saludos
|
Administrar tablas MySql/MaDB embedded
|
Compuin:
El mantenimiento también se puede hacer vía comandos SQL
[code=fw:13h1oi1z]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> cCmdSql := <span style="color: #ff0000;">"INSERT INTO "</span> +;<br /> <span style="color: #ff0000;">"Fijos "</span> +;<br /> <span style="color: #ff0000;">"SET "</span> +;<br /> <span style="color: #ff0000;">"Fij_Cia = '"</span> + STR<span style="color: #000000;">(</span>oRsEmp:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"EMP_CIA"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>,<span style="color: #000000;">02</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"',"</span> +;<br /> <span style="color: #ff0000;">"Fij_Emp = '"</span> + STR<span style="color: #000000;">(</span>oRsEmp:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"EMP_EMP"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>,<span style="color: #000000;">05</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"',"</span> +;<br /> <span style="color: #ff0000;">"Fij_Con = '"</span> + STR<span style="color: #000000;">(</span>nCpto,<span style="color: #000000;">03</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"',"</span> +;<br /> <span style="color: #ff0000;">"Fij_Vec = '"</span> + STR<span style="color: #000000;">(</span>nUnidad,<span style="color: #000000;">05</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"',"</span> +;<br /> <span style="color: #ff0000;">"Fij_Cal = 1"</span> + <span style="color: #ff0000;">","</span> +;<br /> <span style="color: #ff0000;">"Fij_Sdi = '"</span> + STR<span style="color: #000000;">(</span>nSdi,<span style="color: #000000;">11</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span> +<span style="color: #ff0000;">"',"</span> +;<br /> <span style="color: #ff0000;">"Fij_Sdv = '"</span> + STR<span style="color: #000000;">(</span>nSdv,<span style="color: #000000;">11</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span> +<span style="color: #ff0000;">"'"</span><br /><br /> <span style="color: #00C800;">TRY</span><br /> oApp:<span style="color: #000000;">oCon</span>:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span>cCmdSql<span style="color: #000000;">)</span><br /> CATCH oError<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"No pude ejecutar el comando "</span> + cCmdSql,oApp:<span style="color: #000000;">cAplicacion</span><span style="color: #000000;">)</span><br /> ShowError<span style="color: #000000;">(</span>oError<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br /> END<br /> </div>[/code:13h1oi1z]
Como ves ADO nos provee de todo sin necesidad de LIBs de terceros, no digo que no sean buenas, diría
que son excelentes, solo digo que no las necesitas.
Saludos
|
Administrar tablas MySql/MaDB embedded
|
Ok y para usar ADO debes instalar algun driver si es por ejemplo MS-SQL?
|
Administrar tablas MySql/MaDB embedded
|
Para eliminar:
[code=fw:se8q0m90]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> cCmdSql := <span style="color: #ff0000;">"DELETE FROM "</span> +;<br /> <span style="color: #ff0000;">"Variables "</span> +;<br /> <span style="color: #ff0000;">"WHERE "</span> +;<br /> <span style="color: #ff0000;">"Var_Cia = '"</span> + STR<span style="color: #000000;">(</span>oApp:<span style="color: #000000;">nNumCia</span>,<span style="color: #000000;">02</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span> +;<br /> <span style="color: #ff0000;">"AND "</span> +;<br /> <span style="color: #ff0000;">"Var_Emp = '"</span> + STR<span style="color: #000000;">(</span>oRsVar:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"VAR_EMP"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>,<span style="color: #000000;">05</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span> +;<br /> <span style="color: #ff0000;">"AND "</span> +;<br /> <span style="color: #ff0000;">"Var_Con = '"</span> + STR<span style="color: #000000;">(</span>oRsVar:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"VAR_CON"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span>,<span style="color: #000000;">03</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"' "</span> +;<br /> <span style="color: #ff0000;">"AND "</span> +;<br /> <span style="color: #ff0000;">"Var_Ref = '"</span> + oRsVar:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"VAR_REF"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> + <span style="color: #ff0000;">"'"</span><br /> </div>[/code:se8q0m90]
Saludos
|
Administrar tablas MySql/MaDB embedded
|
Compuin:
Sí, es lo más sencillo y te lleva 1 minuto.
Saludos
|
Administrar tablas MySql/MaDB embedded
|
Armando,
Cual debo instalar? Algun link para descargarlo?
|
Administrar tablas MySql/MaDB embedded
|
Compuin:
<!-- m --><a class="postlink" href="https://dev.mysql.com/downloads/connector/odbc/">https://dev.mysql.com/downloads/connector/odbc/</a><!-- m -->
Ahí puedes elegir entre 32 y 64 bits, desde luego el Motor de MySql y el
conector deben ser iguales, de 32 o 64 bits.
Si necesitas más apoyo puedes escribirme a mi correo
estbucarm at gmail dot com
Saludos
|
Administrar tablas MySql/MaDB embedded
|
Y para Microsoft SQL Server ?
|
Administrar tablas MySql/MaDB embedded
|
Compuin:
Aunque no uso Microsoft SQL Server aquí tiene el link
<!-- m --><a class="postlink" href="https://www.microsoft.com/es-es/sql-server/sql-server-downloads">https://www.microsoft.com/es-es/sql-ser ... -downloads</a><!-- m -->
Saludos
|
Administrar tablas MySql/MaDB embedded
|
Muchisimas gracias.
Debo cambiar algo en las consultas si utilizo MS-SQL ?
|
Administrar tablas MySql/MaDB embedded
|
Compuin:
Que yo sepa y con ADO, no.
Saludos
|
Administrar tablas MySql/MaDB embedded
|
Listo.
Ya tengo mi sistema con base embebida (Embedded).
He buscado en la Web algún administrador de bases embebidas y no he tenido éxito.
|
Administrar tablas MySql/MaDB embedded
|
[quote="acuellar":fw6ntvoe]Listo.
Ya tengo mi sistema con base embebida (Embedded).
He buscado en la Web algún administrador de bases embebidas y no he tenido éxito.[/quote:fw6ntvoe]
Excelente!!
Podrias postear como lo hicistes para futuras referencias y que otros puedan apoyarse en tu experiencia?
|
Administrator operations
|
to perform some operations the administrator needs exclusivity, so you should check if a user is online and / or the archives are open.
Does anyone have any idea how to go about doing these checks
Pls, a small sample to init
|
Administrator operations
|
Hello Silvio,
We have a central database from which we can lock the workstations.
But it always assumes that all users exit the program first.
Then it is no longer possible to open the program and the maintenance work can be carried out.
Best regards,
Otto
[code=fw:25jh7bea]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #00C800;">METHOD</span> PC_erfassen<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TAllgemein<br /> <span style="color: #00C800;">local</span> lapped := .t.<br /> *----------------------------------------------------------<br /> <br /> <span style="color: #B900B9;">//hier werden alle WINHOTEL.exen registriert</span><br /> <span style="color: #00C800;">if</span> file<span style="color: #000000;">(</span> Setup<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Daten</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"dataallg<span style="color: #000000;">\P</span>CS.dbf"</span> <span style="color: #000000;">)</span>= .F.<br /> DbCreate<span style="color: #000000;">(</span> Setup<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Daten</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"dataallg<span style="color: #000000;">\P</span>CS.dbf"</span>,;<br /> <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"SERIALNR"</span> , <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"BIOSDATE"</span> , <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"COMPUTER"</span> , <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">5</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"SPERRE"</span> , <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"APPPATH"</span> , <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"DATENVERZ"</span> , <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"DATUM"</span> , <span style="color: #ff0000;">"D"</span>, <span style="color: #000000;">8</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span> ,;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"ZEIT"</span> , <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> use <span style="color: #000000;">(</span> Setup<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Daten</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">"dataallg<span style="color: #000000;">\"</span> + "</span>PCS<span style="color: #ff0000;">") NEW<br /> go top<br /> do while .not. eof()<br /> if (Upper(ALLTRIM(PCS->SERIALNR)) = Setup():cSerialHD) .and. (PCS->BiosDate = Setup():cBiosDate) .and.;<br /> ( Upper(ALLTRIM(PCS->AppPath)) = Upper(ALLTRIM( Setup():AppPath )) )<br /> lapped := .f.<br /> exit<br /> endif<br /> select PCS<br /> skip<br /> enddo<br /> if lapped = .t.<br /> select PCS<br /> append_blank()<br /> <br /> endif<br /> if len(ALLTRIM(PCS->sperre)) > 0<br /> MetroMsgInfo( "</span>Infobox<span style="color: #ff0000;">","</span>Arbeitsstation gesperrt wg. <span style="color: #ff0000;">" + PCS->sperre )<br /> return (.F.)<br />endif<br /><br />IF rlock()<br /> PCS->SERIALNR := Setup():cSerialHD<br /> PCS->computer := Setup():cComputerNr<br /> PCS->BiosDate := Setup():cBiosDate<br /> PCS->AppPath := Setup():AppPath<br /> PCS->datenverz := Setup():DATEN<br /> PCS->DATUM := date()<br /> PCS->zeit := time()<br /> // commit<br /> <br />else<br />return (.F.)<br /><br />endif<br /><br />select PCS<br />use<br /><br />RETURN (.T.)<br />//----------------------------------------------------------------------------//<br /><br /></span></div>[/code:25jh7bea]
[img:25jh7bea]https://mybergland.com/fwforum/lockout.jpg[/img:25jh7bea]
|
Administrator operations
|
I had thought of an archive where to insert all the archives worked by the application. If an archive is open, a warning message must be displayed.
Obviously the Check_Utenti procedure in addition to checking the open archives checks if a record in the Users archive has an asterisk in the Status field because when a user enters the application, the login checks and inserts an asterisk in a field and this is removed on exit.
therefore the user_check procedure must return a true or false logical variable of the type
function test()
local oDlt, lCont
cDbfPath:=cFilePath(GetModuleFileName( GetInstance() )) + "2013\dbf\"
cExePath:= cFilePath(GetModuleFileName( GetInstance() ))
* SET DEFAULT TO &cDbfPath
RddSetDefault( "DBFCDX" )
DEFINE DIALOG oDlt RESOURCE "Dlg_Tmp" //FONT oWnd:oFont
REDEFINE SAY PROMPT "Verificando utenti..." ID 10 OF oDlt
[b:3vf2m8rp] oDlt:bStart:={|| lCont:=CheckUsers(),oDlt:End()}[/b:3vf2m8rp]
ACTIVATE DIALOG oDlt CENTERED
[b:3vf2m8rp] IF !lCont[/b:3vf2m8rp]
[b:3vf2m8rp] msginfo("you can make admin operations")[/b:3vf2m8rp]
.....( the admin operations)
ENDIF
RETURN (NIL)
it's just easier said than built
if i send you a file do you have a chance to try if it works?
|
Ado ?
|
Hola Foro
Alguien tiene alguna idea de como poder meter un bmp, en un campo ole de una base access con ado ?
Un saludo y gracias desde ya
Gabriel
Granada (España)
|
Ado ?
|
El objeto recordset yiene dos metodos para gestionar imagenes ( o data ole) .Estos metodos son AppendChunk y GetChuck.
AppendChunk agrega a un texto largo o un campo de data binaria o en un objeto Parameter de la coleccion Parameters de un objeto Command.
GetChunk lee la data desde la BD
|
Ado & MDB
|
I want use a file MDB on Xharbour( &fw) with ado or another class
I want open a table and make insert,mod,search and print
there is some example to make it ?
Regards
Silvio
|
Ado & MDB
|
First of all, you need to make sure MDAC is installed on your workstation. One way to do this is as follows:
Create a blank file with the extention .UDL (i.e. test.udl).
This file must be blank.
Either click on the file, or from the command prompt type
Start Test.udl
If a data connection wizard appears, then you have MDAC.
If this does not work, then download MDAC from the microsoft website.
btw, if you complete the connection wizard, it will place a valid ADO connection string in the (no longer empty) file. This can be utilized with your code.
Not tested code...
oRs := CreateObject("ADODB.RecordSet")
oRs:CursorLocation := adUseClient
oRs:LockType := adLockOptimistic
oRs:CursorType := adOpenDynamic
oRs:ActiveConnection := 'your connection string copied from the UDL file'
oRs:Source := 'Select * from MyTable' // or other valid sql.
Once you have filled your recordset with data you can utilize the following methods to navigate, (much more information on the Web) Google search for 'ADO RecordSet'
oRs:MoveFirst() // DbGoTop()
oRs:MoveNext() // DbSkip()
oRs:MoveLast() // DbGoBottom()
oRs:AddNew() // DbAppend()
oRs:Update() // DbCommit() but is required to complete add.
Replace...
oRs:Fields("MyCharField"):Value := 'MyValue'
I hope this helps get you started
might come in handy constants...
//---- FileOpenEnum Values ----
#define adOpenForwardOnly 0
#define adOpenKeyset 1
#define adOpenDynamic 2
#define adOpenStatic 3
//---- LockTypeEnum Values ----
#define adLockReadOnly 1
#define adLockPessimistic 2
#define adLockOptimistic 3
#define adLockBatchOptimistic 4
//---- CursorLocationEnum Values ----
#define adUseServer 2
#define adUseClient 3
//---- DataTypeEnum Values ----
#define adEmpty 0
#define adTinyInt 16
#define adSmallInt 2
#define adInteger 3
#define adBigInt 20
#define adUnsignedTinyInt 17
#define adUnsignedSmallInt 18
#define adUnsignedInt 19
#define adUnsignedBigInt 21
#define adSingle 4
#define adDouble 5
#define adCurrency 6
#define adDecimal 14
#define adNumeric 131
#define adBoolean 11
#define adError 10
#define adUserDefined 132
#define adVariant 12
#define adIDispatch 9
#define adIUnknown 13
#define adGUID 72
#define adDate 7
#define adDBDate 133
#define adDBTime 134
#define adDBTimeStamp 135
#define adBSTR 8
#define adChar 129
#define adVarChar 200
#define adLongVarChar 201
#define adWChar 130
#define adVarWChar 202
#define adLongVarWChar 203
#define adBinary 128
#define adVarBinary 204
#define adLongVarBinary 205
#define adChapter 136
#define adFileTime 64
#define adPropVariant 138
#define adVarNumeric 139
#define adArray &H2000
|
Ado & MDB
|
I try this
[code:1jr3x3pb]function Prodotti()
local oBCli , oWChld ,oDlg ,oWnd ,oLbx
Local oDbf
local aData := {}
Local nFor, oOdbc
SET 3D LOOK ON
oOdbc := TOdbc():New("Database di Microsoft Access", "", "")
If !oOdbc:lSuccess
oOdbc:ShowErrorList("Sessione ODBC non inizializzata , Errore...")
oOdbc:End()
return nil
Endif
// Apro la tabella direttamente
oDbf := TDbOdbcDirect():new( "SELECT * FROM prodotti" , oOdbc)
if oOdbc:IsError()
oOdbc:ShowErrorList()
oOdbc:aErrors := {}
oDbf:End()
return nil
endif
oDbf:Open()
oDbf:Complete()
// Creo il list box e i bottoni
DEFINE DIALOG oDlg FROM 3, 3 TO 28, 79 TITLE "Gestione Prodotti"
@ 0, 1 SAY " &Demo" OF oDlg
@ 1, 1 LISTBOX oLbx FIELDS str(oDbf:FieldGet(1)), oDbf:FieldGet(2),oDbf:FieldGet(5) ;
HEADER "ID", "Codice", "Prodotto" ;
SIZE 284, 137 OF oDlg
@ 9, 1 BUTTON "&Nuovo" OF oDlg SIZE 40, 12 action EditClient( oLbx, .t. )
@ 9, 8 BUTTON "&Modifica" OF oDlg SIZE 40, 12
@ 9, 15 BUTTON "&Cancella" OF oDlg SIZE 40, 12
@ 9, 22 BUTTON "&Ricerca" OF oDlg SIZE 40, 12
@ 9, 29 BUTTON "&Stampa" OF oDlg SIZE 40, 12
@ 9, 40 BUTTON "&Uscita" OF oDlg ACTION oDlg:End() SIZE 40, 12
ACTIVATE DIALOG oDlg
oDbf:End()
oOdbc:End()
RETURN (NIL)
[/code:1jr3x3pb]
Now I must convert the EditClient( oLbx, .t. ) function but I cannot How I can make it
this the code
[code:1jr3x3pb]static function EditClient( oLbx, lAppend )
local cName
local cAddress
local cPhone
local nOldRec := RecNo()
DEFAULT lAppend := .f.
if lAppend
GOTO BOTTOM
SKIP
endif
cName = Clientes->Nombre && field0001
cAddress = Clientes->Direccion && field0002
cPhone = Clientes->Telefono && field0003
DEFINE DIALOG oDlg FROM 8, 2 TO 25, 65 ;
TITLE If( lAppend, "New Customer", "Customer Update" )
@ 1, 1 SAY "&Name:" OF oDlg
@ 1, 6 GET cName OF oDlg
@ 2, 1 SAY "&Address:" OF oDlg
@ 2, 6 GET cAddress OF oDlg
@ 3.5, 23 SAY "&Phone:" OF oDlg
@ 4, 21 GET cPhone OF oDlg SIZE 60, 11 PICTURE "@R 99-999-9999999"
@ 6, 9 BUTTON "&Acept" OF oDlg SIZE 50, 12 ACTION ( lSave := .t. , oDlg:End() )
@ 6, 19 BUTTON "&Cancel" OF oDlg SIZE 50, 12 ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
if lSave .and. !empty( cName )
if lAppend
APPEND BLANK
endif
Clientes->Nombre := cName
Clientes->Direccion := cAddress
Clientes->Telefono := cPhone
oLbx:Refresh() // We want the ListBox to be repainted
else
if Empty( cName ) .and. lSave
MsgAlert( "Please write a name" )
endif
GOTO nOldRec
endif
return nil
[/code:1jr3x3pb]
|
Ado & MDB
|
I need I test sample with addneww func
Pls Help me
Regards
|
Ado - consulta en xbrowse
|
ok, tengo la siguiente situación con ado
[code=fw:39wbut42]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRS:<span style="color: #000000;">Source</span> = <span style="color: #ff0000;">" select * from ventas where fecha='2013-08-01' "</span><br /><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">XBROWSE</span> ... DATASOURCE oRS<br /> </div>[/code:39wbut42]
hasta aca todo bien, pero como puedo hacer para que sin cerra el dialogo con el browese, cambiar el source del recordset y muestre otros datos, (cambio la fecha) pensaba algo asi:
[code=fw:39wbut42]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">function</span> changeData<span style="color: #000000;">(</span> oBrw <span style="color: #000000;">)</span><br />?oRS, oRS:<span style="color: #000000;">Source</span> <span style="color: #B900B9;">//muestra los datos correctos</span><br />oRS:<span style="color: #000000;">Source</span> = <span style="color: #ff0000;">" select * from ventas where fecha='2013-08-15' "</span> <span style="color: #B900B9;">//aca falla indicando que oRS es indefinido</span><br />oRS:<span style="color: #000000;">Requery</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oBrw:<span style="color: #000000;">Gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">return</span> <span style="color: #000000;">0</span><br /> </div>[/code:39wbut42]
pero falla indicando que oRS es invalido, aun cuando es una var statica y he validado su contenido.
intente haciendo un
[code=fw:39wbut42]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oRS:<span style="color: #000000;">Source</span> = <span style="color: #ff0000;">" select * from ventas where fecha='2013-08-15' "</span> <br /> </div>[/code:39wbut42]
pero ahi revienta el xbrowse
|
Ado - consulta en xbrowse
|
#1. In ADO we can not change oRs:Source and ReQuery. Requery() is possible only with the same Source ( SQL )
#2. Switching Recordset of XBrowse dynamically during runtime:
Conditions:
a) All fields are identical in both RecordSets
b) Good xbrowse programming uses command syntax and you do not directly use oRs in your code.
Procedure:
Creating xbrowse first time
oRs:Open()
@ 0,0 XBROWSE oBrw DATASOURCE oRs COLUMNS "FIRST","LAST","SALARY" ................. etc
Switching:
Open new Recset
oNewRs:Open( ..... )
oBrw:GoTop()
oBrw:oRs := oRsNew
oRs:Close()
oBrw:Refresh()
|
Ado - consulta en xbrowse
|
Rao, excelente.
thank you.
|
Ado - consulta en xbrowse
|
Carlos:
Yo lo hago así y funciona bien:
Al principio de PRG abro la tabla creando el RecordSet considerando el mes y año actuales
y se crea el xBrowse, posteriormente el usuario puede elegir otro mes u otro año y el resultado
se muestra en el mismo browse. Este es el código donde se re crea el recordset:
[code=fw:3nlgqyw2]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">COMBOBOX</span> aGets<span style="color: #000000;">[</span><span style="color: #000000;">01</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> nMes <span style="color: #0000ff;">ID</span> <span style="color: #000000;">101</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span>;<br /> <span style="color: #0000ff;">PROMPTS</span> aMeses;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span>FilHdr<span style="color: #000000;">(</span>oBrw<span style="color: #000000;">)</span>,oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,oDlg:<span style="color: #0000ff;">UPDATE</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /> <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"Elija el nombre del mes de las facturas que desea mostrar"</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> aGets<span style="color: #000000;">[</span><span style="color: #000000;">02</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">VAR</span> nAmo <span style="color: #0000ff;">ID</span> <span style="color: #000000;">102</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span>;<br /> <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"9999"</span> SPINNER;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span>FilHdr<span style="color: #000000;">(</span>oBrw<span style="color: #000000;">)</span>,oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,oDlg:<span style="color: #0000ff;">UPDATE</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /> <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"Año de las facturas a mostrar"</span><br /><br />........<br />........<br />.........<br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> FilHdr<span style="color: #000000;">(</span>oBrw<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> oRsHdr <> <span style="color: #00C800;">NIL</span><br /> <span style="color: #00C800;">IF</span> oRsHdr:<span style="color: #000000;">State</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> = adStateOpen<br /> oRsHdr:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> oRsHdr:<span style="color: #000000;">Source</span> := <span style="color: #ff0000;">"SELECT "</span> +;<br /> <span style="color: #ff0000;">"*,"</span> +;<br /> <span style="color: #ff0000;">"Metodos.*,"</span> +;<br /> <span style="color: #ff0000;">"Monedas.* "</span> +;<br /> <span style="color: #ff0000;">"FROM "</span> +;<br /> <span style="color: #ff0000;">"HdrFac "</span> +;<br /> <span style="color: #ff0000;">"LEFT JOIN "</span> +;<br /> <span style="color: #ff0000;">"Metodos "</span> +;<br /> <span style="color: #ff0000;">"ON "</span> +;<br /> <span style="color: #ff0000;">"Hdr_Mdp = Metodos.Met_Met "</span> +;<br /> <span style="color: #ff0000;">"LEFT JOIN "</span> +;<br /> <span style="color: #ff0000;">"Monedas "</span> +;<br /> <span style="color: #ff0000;">"ON "</span> +;<br /> <span style="color: #ff0000;">"Hdr_Mon = Monedas.Mon_Num "</span> +;<br /> <span style="color: #ff0000;">"WHERE "</span> +;<br /> <span style="color: #ff0000;">"YEAR(Hdr_Fde) = "</span> + STR<span style="color: #000000;">(</span>nAmo,<span style="color: #000000;">4</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">" "</span> +;<br /> <span style="color: #ff0000;">"AND "</span> +;<br /> <span style="color: #ff0000;">"MONTH(Hdr_Fde) = "</span> + STR<span style="color: #000000;">(</span>nMes,<span style="color: #000000;">2</span>,<span style="color: #000000;">0</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">" "</span> +;<br /> <span style="color: #ff0000;">"AND "</span> +;<br /> <span style="color: #ff0000;">"Hdr_Tip = 'FA' "</span> +;<br /> <span style="color: #ff0000;">"ORDER BY "</span> +;<br /> <span style="color: #ff0000;">"Hdr_Ser,Hdr_Num"</span><br /><br /> <span style="color: #00C800;">TRY</span><br /> oRsHdr:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRsHdr:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> CATCH oError<br /> MsgStop<span style="color: #000000;">(</span> <span style="color: #ff0000;">"No se ha podido abrir el RECORDSET de Encabezado de Facturas !"</span>, oApp:<span style="color: #000000;">cAplicacion</span><span style="color: #000000;">)</span><br /> ShowError<span style="color: #000000;">(</span>oError<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br /> END<br /><br /> oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.T.<span style="color: #000000;">)</span><br /> </div>[/code:3nlgqyw2]
Como ves, todo es con el mismo recordset y con el mismo xBrowse
Un detalle más, el recordset lo tengo definido como STATIC
Saludos
|
Ado - consulta en xbrowse
|
Mr Armando
Your method is
1. close recordset under browse
2. open recordset with new sql
This has risks:
1. If for some reason, browse is refreshed ( can happen for many reasons not in our control) after the recordset is closed, browse will crash with runtime error
2. if seond record set is not open, you can not keep the browse open.
I suggested in my post, safe way to switch the recordsets:
1. Open new recordset
2. Take browse to Top
3. Assign new recordset to the browse
4. Close old recordset
this order is safe
|
Ado - consulta en xbrowse
|
rao,
este es mi prg de prueba, me ha funcionado como usted me indico, pero es de mi interés solamente usar una sola variable oRS, por que al igual que armando es una var estatica.
armando, usando tu logica que es la mas evidente me falla el browse al momento del cambio, es como indica rao. <!-- s:-( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":-(" title="Sad" /><!-- s:-( -->
[code=fw:3ageorth]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> oNRS := GetRecSet<span style="color: #000000;">(</span> <span style="color: #ff0000;">"'2013-08-27'"</span>, <span style="color: #ff0000;">"10"</span> <span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">oRS</span> := oNRS<br /> oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> </div>[/code:3ageorth]
ejemplo completo, uso ado con ads. es rapidísimo, mas que la version dbf
[code=fw:3ageorth]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-10</span>,<span style="color: #000000;">-10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> COLUMNS <span style="color: #ff0000;">"REVISADO"</span>,<span style="color: #ff0000;">"APROBADO"</span>,<span style="color: #ff0000;">"NUM_CLIE"</span>, <span style="color: #ff0000;">"NOMBRE"</span>, <span style="color: #ff0000;">"FECHA_SOLI"</span>, <span style="color: #ff0000;">"FECHA_DESE"</span>, <span style="color: #ff0000;">"PLAZO"</span>, <span style="color: #ff0000;">"MONTO_SOLI"</span>, <span style="color: #ff0000;">"MONTO_APRO"</span>,<span style="color: #ff0000;">"CIUDAD"</span>,<span style="color: #ff0000;">"RUTA"</span> ;<br /> HEADERS <span style="color: #ff0000;">"REVISADO"</span>,<span style="color: #ff0000;">"APROBADO"</span>,<span style="color: #ff0000;">"NUM_CLIE"</span>, <span style="color: #ff0000;">"NOMBRE"</span>, <span style="color: #ff0000;">"FECHA_SOLI"</span>, <span style="color: #ff0000;">"FECHA_DESE"</span>, <span style="color: #ff0000;">"PLAZO"</span>, <span style="color: #ff0000;">"MONTO_SOLI"</span>, <span style="color: #ff0000;">"MONTO_APRO"</span>,<span style="color: #ff0000;">"CIUDAD"</span>,<span style="color: #ff0000;">"RUTA"</span> ;<br /> DATASOURCE oRS ;<br /> CELL LINES NOBORDER FOOTERS <br /> <br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">MONTO_SOLI</span>:<span style="color: #000000;">nFooterType</span> := AGGR_SUM<br /> :<span style="color: #000000;">MONTO_APRO</span>:<span style="color: #000000;">nFooterType</span> := AGGR_SUM<br /> :<span style="color: #000000;">bKeyDown</span> := <span style="color: #000000;">{</span>|nKey| Editar<span style="color: #000000;">(</span> nKey, oBrw <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">nStretchCol</span> := <span style="color: #000000;">1</span> <br /> :<span style="color: #000000;">MakeTotals</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> END<br /><br /> oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /> <br /> oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oCon:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">return</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> ConnectToAdsSrv<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> lConnect := .f. <br /> <span style="color: #00C800;">local</span> oError, xError, cError := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">local</span> cStrCon := <span style="color: #ff0000;">"Provider=Advantage OLE DB Provider;"</span>+;<br /> <span style="color: #ff0000;">"Data Source=<span style="color: #000000;">\\</span>CREDICOM.NO-IP.ORG:6263<span style="color: #000000;">\D</span>ATOS<span style="color: #000000;">\C</span>REDICOM.ADD;"</span>+;<br /> <span style="color: #ff0000;">"ServerType=ADS_AIS_SERVER;"</span>+;<br /> <span style="color: #ff0000;">"TableType=ADS_ADT;"</span>+;<br /> <span style="color: #ff0000;">"LockMode=ADS_COMPATIBLE_LOCKING;"</span>+;<br /> <span style="color: #ff0000;">"User ID=MyUsuario;"</span>+;<br /> <span style="color: #ff0000;">"Password=MyClave;"</span> <br /> <br /> <span style="color: #00C800;">if</span> oCon == <span style="color: #00C800;">nil</span><br /> oCon := TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"ADODB.Connection"</span><span style="color: #000000;">)</span><br /> oCon:<span style="color: #000000;">ConnectionString</span> := cStrCon <br /> <span style="color: #00C800;">TRY</span><br /> oCon:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> lConnect := .t.<br /> CATCH oError<br /> <span style="color: #00C800;">IF</span> oCon:<span style="color: #000000;">Errors</span>:<span style="color: #0000ff;">Count</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>><span style="color: #000000;">0</span><br /> <span style="color: #00C800;">FOR</span> EACH xError IN oCon:<span style="color: #000000;">Errors</span><br /> cError += CStr<span style="color: #000000;">(</span> xError:<span style="color: #000000;">Source</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" / "</span> + CStr<span style="color: #000000;">(</span> xError:<span style="color: #000000;">Description</span> <span style="color: #000000;">)</span> + HB_OsNewLine<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">NEXT</span><br /> MsgAlert<span style="color: #000000;">(</span> cError, <span style="color: #ff0000;">"Error en ADO"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span> <br /> oCon := <span style="color: #00C800;">nil</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">'Connect Fail'</span> + oError:<span style="color: #000000;">description</span> <span style="color: #000000;">)</span> <br /> END<br /> <span style="color: #00C800;">else</span><br /> lConnect := .t.<br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> lConnect<br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> GetRecSet<span style="color: #000000;">(</span> cFecha, cCiudad <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cStrSQL, oError, oRecSet<br /> <br /> cSQL := <span style="color: #ff0000;">"SELECT P.REVISADO, P.APROBADO, P.NUM_CLIE, P.NOMBRE, P.FECHA_SOLI, P.FECHA_DESE, P.PLAZO, P.MONTO_SOLI, P.MONTO_APRO, P.NUM_CIUD, P.ADESEMBOLSO, "</span> + ;<br /> <span style="color: #ff0000;">"K.NOMCOR AS CIUDAD, J.NOMCOR AS RUTA "</span> + ;<br /> <span style="color: #ff0000;">"FROM PROGRAMACION P "</span> + ;<br /> <span style="color: #ff0000;">"LEFT OUTER JOIN CLIENTES AS C ON P.NUM_CLIE=C.NUM_CLIE "</span> + ;<br /> <span style="color: #ff0000;">"LEFT OUTER JOIN CIUDADES AS K ON C.NUM_CIUD=K.NUM_CIUD "</span> + ;<br /> <span style="color: #ff0000;">"LEFT OUTER JOIN RUTAS AS J ON C.NUM_RUTA=J.NUM_RUTA "</span> + ;<br /> <span style="color: #ff0000;">"WHERE FECHA_SOLI=%1 AND P.NUM_CIUD=%2 AND P.ADESEMBOLSO<>TRUE "</span><br /> cStrSQL := StrFormat<span style="color: #000000;">(</span> cSQL, cFecha, cCiudad <span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">if</span> oCon != <span style="color: #00C800;">nil</span><br /> oRecSet := TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADODB.RecordSet"</span> <span style="color: #000000;">)</span><br /> oRecSet:<span style="color: #000000;">ActiveConnection</span> := oCon<br /> oRecSet:<span style="color: #000000;">Source</span> := cStrSQL<br /> oRecSet:<span style="color: #000000;">LockType</span> := adLockOptimistic<br /> oRecSet:<span style="color: #000000;">CursorType</span> := adOpenKeyset<br /> oRecSet:<span style="color: #000000;">CursorLocation</span> := adUseClient<br /> oRecSet:<span style="color: #000000;">CacheSize</span> := <span style="color: #000000;">100</span><br /> <span style="color: #00C800;">TRY</span><br /> oRecSet:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRecSet:<span style="color: #000000;">Sort</span> := <span style="color: #ff0000;">"NOMBRE"</span><br /> CATCH oError<br /> oRecSet := <span style="color: #00C800;">NIL</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">'Access Table Open Failure - '</span> + oError:<span style="color: #000000;">description</span> <span style="color: #000000;">)</span><br /> END<br /> <br /> <span style="color: #00C800;">endif</span> <br /> <br /><span style="color: #00C800;">return</span> oRecSet<br /><br />procedure editar<span style="color: #000000;">(</span> nKey, oBrw <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cDato, nPos <br /> <span style="color: #00C800;">local</span> cStrSQL<br /> <br /> <span style="color: #00C800;">IF</span> nKey == <span style="color: #000000;">13</span><br /> nPos := oRS:<span style="color: #000000;">AbsolutePosition</span><br /> cDato := oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"NOMBRE"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><br /> <span style="color: #00C800;">IF</span> MsgGet<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Titulo"</span>, <span style="color: #ff0000;">"Text"</span>, @cDato <span style="color: #000000;">)</span><br /> oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"NOMBRE"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cDato<br /> oRS:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRS:<span style="color: #000000;">Requery</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRS:<span style="color: #000000;">AbsolutePosition</span> := nPos<br /> <span style="color: #00C800;">ENDIF</span><br /> ELSEIF nKey == <span style="color: #000000;">65</span> <span style="color: #B900B9;">// usuario presiono A</span><br /> oNRS := GetRecSet<span style="color: #000000;">(</span> <span style="color: #ff0000;">"'2013-08-27'"</span>, <span style="color: #ff0000;">"10"</span> <span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">oRS</span> := oNRS<br /> oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span> <br /> <br /><span style="color: #00C800;">return</span> <br /><br /><span style="color: #0000ff;">init</span> procedure PrgInit<br /><br /> SET DATE BRIT<br /> SET CENTURY <span style="color: #0000ff;">ON</span><br /> SET TIME FORMAT <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HH:MM:SS"</span><br /> SET EPOCH <span style="color: #0000ff;">TO</span> <span style="color: #0000ff;">YEAR</span><span style="color: #000000;">(</span>DATE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><span style="color: #000000;">-50</span><br /><br /> SET DELETED <span style="color: #0000ff;">ON</span><br /> SET EXCLUSIVE OFF<br /><br /> RDDSETDEFAULT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"DBFCDX"</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span><br /> </div>[/code:3ageorth]
|
Ado - consulta en xbrowse
|
#1) Can you please let me know the version of FWH you are using?
After you reply I shall post an improved working sample
#2) I use google translate to understand your posting. Did you say you are using one static variable oRs and use oRs in the program to refer to the recordset being browsed?
If so you can do
(a) Add one line in this code
[code=fw:2ffs6kxt]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> ELSEIF nKey == <span style="color: #000000;">65</span> <span style="color: #B900B9;">// usuario presiono A</span><br /> oNRS := GetRecSet<span style="color: #000000;">(</span> <span style="color: #ff0000;">"'2013-08-27'"</span>, <span style="color: #ff0000;">"10"</span> <span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">oRS</span> := oNRS<br /> oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRs := oBrw:<span style="color: #000000;">oRs</span> <span style="color: #B900B9;">// Add this line here</span><br /> <span style="color: #00C800;">ENDIF</span><br /> </div>[/code:2ffs6kxt]
Then rest of your code will work normally.
Some other advices:
1. After modifying a field is NOT necessary or desirable to call ReQuery(). It is not a good practice to call Requery() except when it is "essential". This is a very slow operation.
2. If you want to refer to oRs in program code, it is always better to use oBrw:oRs
Example
Instead of oRs:fields( 2 ):Value
Use oBrw:oRs:Fields( 2 ):Value
This habit of coding enables swithing oRs at runtime easier.
3. As far as possible, you may use built in edit features of xbrowse.
I can advise better if I know your version of FWH
|
Ado - consulta en xbrowse
|
fwh 13.02, xharbour, bcc650
salu2
carlos vargas
|
Ado - consulta en xbrowse
|
[quote="carlos vargas":1vevbsba]fwh 13.02, xharbour, bcc650
salu2
carlos vargas[/quote:1vevbsba]
Thanks for the info.
Have you read my posting above? ( revised).
Does it help you?
In your version, the inbuilt edit of ado browse should work well. Edited values are automatically saved and updated without your having to write code.
|
Ado - consulta en xbrowse
|
rao,
probare esta noche y dejo comentarios.
gracias por el soporte.
salu2
carlos vargas
|
Ado - consulta en xbrowse
|
Rao,
is working well. It is wonderful how quickly ado. I have a question, as I change the source of the query, the application consumption is rising more and more. I think it is reference previous consultations. I modified the code a bit you could take a peek.
[code=fw:2zexl1yw]<div class="fw" id="{CB}" style="font-family: monospace;"><br />procedure editar<span style="color: #000000;">(</span> nKey, oBrw <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cDato, nPos <br /> <span style="color: #00C800;">local</span> cStrSQL, oNewRS<br /> <br /> <span style="color: #00C800;">IF</span> nKey == <span style="color: #000000;">13</span><br /> nPos := oRS:<span style="color: #000000;">AbsolutePosition</span><br /> cDato := oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"NOMBRE"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><br /> <span style="color: #00C800;">IF</span> MsgGet<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Titulo"</span>, <span style="color: #ff0000;">"Text"</span>, @cDato <span style="color: #000000;">)</span><br /> oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"NOMBRE"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cDato<br /> oRS:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oBrw:<span style="color: #000000;">RefreshCurrent</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ELSEIF nKey == <span style="color: #000000;">65</span><br /> oNewRS := GetRecSet<span style="color: #000000;">(</span> MsgDate<span style="color: #000000;">(</span> date<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> , <span style="color: #000000;">10</span> <span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">oRS</span> := oNewRS<br /> oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRS:=<span style="color: #00C800;">NIL</span><br /> oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">MakeTotals</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRS := oBrw:<span style="color: #000000;">oRS</span><br /> oNewRS := <span style="color: #00C800;">NIL</span> <br /> <span style="color: #00C800;">ENDIF</span> <br /> <br /><span style="color: #00C800;">return</span> <br /> </div>[/code:2zexl1yw]
|
Ado - consulta en xbrowse
|
memory up. <!-- s:-( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":-(" title="Sad" /><!-- s:-( -->
[code=fw:2q6kqq52]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">oRS</span> := GetRecSet<span style="color: #000000;">(</span> MsgDate<span style="color: #000000;">(</span> date<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> , <span style="color: #000000;">10</span> <span style="color: #000000;">)</span><br /> oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRS:=<span style="color: #00C800;">NIL</span><br /> oRS := oBrw:<span style="color: #000000;">oRS</span> <br /> oBrw:<span style="color: #000000;">MakeTotals</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> </div>[/code:2q6kqq52]
|
Ado - consulta en xbrowse
|
[code=fw:g7rjsil9]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.Ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"xbrowse.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"adodef.ch"</span><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #00C800;">static</span> oCon<br /><span style="color: #00C800;">static</span> cSQL<br /><br />memvar oRS<br /><br />procedure Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oDlg, oBrw, oFont<br /> <span style="color: #00C800;">private</span> oRS<br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">'TAHOMA'</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-12</span> <br /> <br /> <span style="color: #00C800;">IF</span> ConnectToAdsSrv<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRS := GetRecSet<span style="color: #000000;">(</span> date<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #000000;">10</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> oRS == <span style="color: #00C800;">NIL</span><br /> oCon:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">return</span><br /> <span style="color: #00C800;">ENDIF</span> <br /> <span style="color: #00C800;">ENDIF</span> <br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">900</span>, <span style="color: #000000;">500</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont<br /> <br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-10</span>,<span style="color: #000000;">-10</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> COLUMNS <span style="color: #ff0000;">"REVISADO"</span>,<span style="color: #ff0000;">"APROBADO"</span>,<span style="color: #ff0000;">"NUM_CLIE"</span>, <span style="color: #ff0000;">"NOMBRE"</span>, <span style="color: #ff0000;">"FECHA_SOLI"</span>, <span style="color: #ff0000;">"FECHA_DESE"</span>, <span style="color: #ff0000;">"PLAZO"</span>, <span style="color: #ff0000;">"MONTO_SOLI"</span>, <span style="color: #ff0000;">"MONTO_APRO"</span>,<span style="color: #ff0000;">"CIUDAD"</span>,<span style="color: #ff0000;">"RUTA"</span> ;<br /> HEADERS <span style="color: #ff0000;">"REVISADO"</span>,<span style="color: #ff0000;">"APROBADO"</span>,<span style="color: #ff0000;">"NUM_CLIE"</span>, <span style="color: #ff0000;">"NOMBRE"</span>, <span style="color: #ff0000;">"FECHA_SOLI"</span>, <span style="color: #ff0000;">"FECHA_DESE"</span>, <span style="color: #ff0000;">"PLAZO"</span>, <span style="color: #ff0000;">"MONTO_SOLI"</span>, <span style="color: #ff0000;">"MONTO_APRO"</span>,<span style="color: #ff0000;">"CIUDAD"</span>,<span style="color: #ff0000;">"RUTA"</span> ;<br /> DATASOURCE oRS ;<br /> CELL LINES NOBORDER FOOTERS <br /> <br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">MONTO_SOLI</span>:<span style="color: #000000;">nFooterType</span> := AGGR_SUM<br /> :<span style="color: #000000;">MONTO_APRO</span>:<span style="color: #000000;">nFooterType</span> := AGGR_SUM<br /> :<span style="color: #000000;">bKeyDown</span> := <span style="color: #000000;">{</span>|nKey| Editar<span style="color: #000000;">(</span> nKey, oBrw <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> :<span style="color: #000000;">nStretchCol</span> := <span style="color: #000000;">1</span> <br /> :<span style="color: #000000;">MakeTotals</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> END<br /><br /> oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /> <br /> oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oCon:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">return</span><br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> ConnectToAdsSrv<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> lConnect := .f. <br /> <span style="color: #00C800;">local</span> oError, xError, cError := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">local</span> cStrCon := <span style="color: #ff0000;">"Provider=Advantage OLE DB Provider;"</span>+;<br /> <span style="color: #ff0000;">"Data Source=<span style="color: #000000;">\\</span>CREDICOM.NO-IP.ORG:6260<span style="color: #000000;">\D</span>ATOS<span style="color: #000000;">\C</span>REDICOM2.ADD;"</span>+;<br /> <span style="color: #ff0000;">"ServerType=ADS_AIS_SERVER;"</span>+;<br /> <span style="color: #ff0000;">"TableType=ADS_ADT;"</span>+;<br /> <span style="color: #ff0000;">"LockMode=ADS_COMPATIBLE_LOCKING;"</span>+;<br /> <span style="color: #ff0000;">"User ID=Usuario;"</span>+;<br /> <span style="color: #ff0000;">"Password=Clave;"</span> <br /> <br /> <span style="color: #00C800;">if</span> oCon == <span style="color: #00C800;">nil</span><br /> oCon := TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"ADODB.Connection"</span><span style="color: #000000;">)</span><br /> oCon:<span style="color: #000000;">ConnectionString</span> := cStrCon <br /> <span style="color: #00C800;">TRY</span><br /> oCon:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> lConnect := .t.<br /> CATCH oError<br /> <span style="color: #00C800;">IF</span> oCon:<span style="color: #000000;">Errors</span>:<span style="color: #0000ff;">Count</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>><span style="color: #000000;">0</span><br /> <span style="color: #00C800;">FOR</span> EACH xError IN oCon:<span style="color: #000000;">Errors</span><br /> cError += CStr<span style="color: #000000;">(</span> xError:<span style="color: #000000;">Source</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" / "</span> + CStr<span style="color: #000000;">(</span> xError:<span style="color: #000000;">Description</span> <span style="color: #000000;">)</span> + HB_OsNewLine<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">NEXT</span><br /> MsgAlert<span style="color: #000000;">(</span> cError, <span style="color: #ff0000;">"Error en ADO"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span> <br /> oCon := <span style="color: #00C800;">nil</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">'Connect Fail'</span> + oError:<span style="color: #000000;">description</span> <span style="color: #000000;">)</span> <br /> END<br /> <span style="color: #00C800;">else</span><br /> lConnect := .t.<br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> lConnect<br /><br /><span style="color: #00C800;">static</span> <span style="color: #00C800;">function</span> GetRecSet<span style="color: #000000;">(</span> dFecha, nCiudad <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cStrSQL, oError, oRecSet<br /> <br /> <span style="color: #00C800;">IF</span> cSQL == <span style="color: #00C800;">NIL</span><br /> cSQL := <span style="color: #ff0000;">"SELECT P.REVISADO, P.APROBADO, P.NUM_CLIE, P.NOMBRE, P.FECHA_SOLI, P.FECHA_DESE, P.PLAZO, P.MONTO_SOLI, P.MONTO_APRO, P.NUM_CIUD, P.ADESEMBOLSO, "</span> + ;<br /> <span style="color: #ff0000;">"K.NOMCOR AS CIUDAD, J.NOMCOR AS RUTA "</span> + ;<br /> <span style="color: #ff0000;">"FROM PROGRAMACION P "</span> + ;<br /> <span style="color: #ff0000;">"LEFT OUTER JOIN CLIENTES AS C ON P.NUM_CLIE=C.NUM_CLIE "</span> + ;<br /> <span style="color: #ff0000;">"LEFT OUTER JOIN CIUDADES AS K ON C.NUM_CIUD=K.NUM_CIUD "</span> + ;<br /> <span style="color: #ff0000;">"LEFT OUTER JOIN RUTAS AS J ON C.NUM_RUTA=J.NUM_RUTA "</span> + ;<br /> <span style="color: #ff0000;">"WHERE FECHA_SOLI=%1 AND P.NUM_CIUD=%2 AND P.ADESEMBOLSO<>TRUE "</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <br /> cStrSQL := StrFormat<span style="color: #000000;">(</span> cSQL, Data2ADO<span style="color: #000000;">(</span> dFecha <span style="color: #000000;">)</span>, Data2ADO<span style="color: #000000;">(</span> nCiudad <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">if</span> oCon != <span style="color: #00C800;">nil</span><br /> oRecSet := TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADODB.RecordSet"</span> <span style="color: #000000;">)</span><br /> oRecSet:<span style="color: #000000;">ActiveConnection</span> := oCon<br /> oRecSet:<span style="color: #000000;">Source</span> := cStrSQL<br /> oRecSet:<span style="color: #000000;">LockType</span> := adLockOptimistic<br /> oRecSet:<span style="color: #000000;">CursorType</span> := adOpenKeyset<br /> oRecSet:<span style="color: #000000;">CursorLocation</span> := adUseClient<br /> oRecSet:<span style="color: #000000;">CacheSize</span> := <span style="color: #000000;">100</span><br /> <span style="color: #00C800;">TRY</span><br /> oRecSet:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRecSet:<span style="color: #000000;">Sort</span> := <span style="color: #ff0000;">"NOMBRE"</span><br /> CATCH oError<br /> oRecSet := <span style="color: #00C800;">NIL</span><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">'Access Table Open Failure - '</span> + oError:<span style="color: #000000;">description</span> <span style="color: #000000;">)</span><br /> END<br /> <br /> <span style="color: #00C800;">endif</span> <br /> <br /><span style="color: #00C800;">return</span> oRecSet<br /><br />procedure editar<span style="color: #000000;">(</span> nKey, oBrw <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cDato, nPos <br /> <span style="color: #00C800;">local</span> cStrSQL, oNewRS<br /> <br /> <span style="color: #00C800;">IF</span> nKey == <span style="color: #000000;">13</span><br /> nPos := oRS:<span style="color: #000000;">AbsolutePosition</span><br /> cDato := oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"NOMBRE"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><br /> <span style="color: #00C800;">IF</span> MsgGet<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Titulo"</span>, <span style="color: #ff0000;">"Text"</span>, @cDato <span style="color: #000000;">)</span><br /> oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"NOMBRE"</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cDato<br /> oRS:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oBrw:<span style="color: #000000;">RefreshCurrent</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ELSEIF nKey == <span style="color: #000000;">65</span> <br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">oRS</span> := GetRecSet<span style="color: #000000;">(</span> MsgDate<span style="color: #000000;">(</span> date<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> , <span style="color: #000000;">10</span> <span style="color: #000000;">)</span><br /> oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRS:=<span style="color: #00C800;">NIL</span><br /> oRS := oBrw:<span style="color: #000000;">oRS</span> <br /> oBrw:<span style="color: #000000;">MakeTotals</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">ENDIF</span> <br /> <br /><span style="color: #00C800;">return</span> <br /><br /><span style="color: #0000ff;">init</span> procedure PrgInit<br /><br /> SET DATE BRIT<br /> SET CENTURY <span style="color: #0000ff;">ON</span><br /> SET TIME FORMAT <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HH:MM:SS"</span><br /> SET EPOCH <span style="color: #0000ff;">TO</span> <span style="color: #0000ff;">YEAR</span><span style="color: #000000;">(</span>DATE<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><span style="color: #000000;">-50</span><br /><br /> SET DELETED <span style="color: #0000ff;">ON</span><br /> SET EXCLUSIVE OFF<br /><br /> RDDSETDEFAULT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"DBFCDX"</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span><br /><br /><span style="color: #00C800;">FUNCTION</span> Data2ADO<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> cValue := <span style="color: #ff0000;">"''"</span><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br /> <span style="color: #00C800;">CASE</span> HB_IsString<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span><br /> cValue := <span style="color: #ff0000;">"'"</span> + xValue + <span style="color: #ff0000;">"'"</span><br /> <span style="color: #00C800;">CASE</span> HB_IsNumeric<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span><br /> cValue := AllTrim<span style="color: #000000;">(</span> CStr<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">CASE</span> HB_IsLogical<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span><br /> cValue := IIf<span style="color: #000000;">(</span> xValue, <span style="color: #ff0000;">'True'</span>, <span style="color: #ff0000;">'False'</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">CASE</span> HB_IsDate<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span><br /> cValue := <span style="color: #ff0000;">"'"</span> + Transform<span style="color: #000000;">(</span> DToS<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span>, <span style="color: #ff0000;">"@R 9999-99-99"</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">"'"</span><br /> <span style="color: #00C800;">CASE</span> HB_IsDateTime<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span><br /> cValue := <span style="color: #ff0000;">"'"</span> + Transform<span style="color: #000000;">(</span> TToS<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span>, <span style="color: #ff0000;">"@R 9999-99-99 99:99:99"</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">"'"</span><br /> <span style="color: #00C800;">CASE</span> HB_IsNil<span style="color: #000000;">(</span> xValue <span style="color: #000000;">)</span><br /> cValue := <span style="color: #ff0000;">"'NULL'"</span><br /> <span style="color: #00C800;">ENDCASE</span><br /><br /><span style="color: #00C800;">RETURN</span> cValue<br /> </div>[/code:g7rjsil9]
|
Ado - consulta en xbrowse
|
Yes, setting oRs and oNewRs to nil is Good <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
Hope everything is working fine.
|
Ado - consulta en xbrowse
|
rao,
memory continues to increase. <!-- s:-( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":-(" title="Sad" /><!-- s:-( -->
salu2
|
Ado - consulta en xbrowse
|
Carlos, quizá esto te ayude
[code=fw:2kip7582]<div class="fw" id="{CB}" style="font-family: monospace;">oBrow:<span style="color: #000000;">oRs</span>:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> ********************* OJO PRIMERO LO CIERRO<br /><br /> oBrow:<span style="color: #000000;">oRs</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"select * order by nomclipro"</span>, cStrConexion <span style="color: #000000;">)</span> *************** LUEGO LO ABRO<br /> oBrow:<span style="color: #000000;">lAutoSort</span> := .T.<br /> oBrow:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrow:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrow:<span style="color: #000000;">SETFOCUS</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:2kip7582]
Saludos
|
Ado - consulta en xbrowse
|
Perdon por la prisas
[code=fw:20q90ky4]<div class="fw" id="{CB}" style="font-family: monospace;">oBrow:<span style="color: #000000;">oRs</span>:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> ********************* OJO PRIMERO LO CIERRO<br /><br /> oBrow:<span style="color: #000000;">oRs</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"select * [b:20q90ky4]from documentos[/b:20q90ky4] order by nomclipro"</span>, cStrConexion <span style="color: #000000;">)</span> *************** LUEGO LO ABRO<br /> oBrow:<span style="color: #000000;">lAutoSort</span> := .T.<br /> oBrow:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrow:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oBrow:<span style="color: #000000;">SETFOCUS</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:20q90ky4]
|
Ado - consulta en xbrowse
|
okis, probare hoy noche.
les comento como me fue...
|
Ado : Field Definition
|
Hello ,
I try to use the defined datatypes from adodef.ch , i can only test in ADO , *.mdb or *.accdb
The goal is that the syntax is also accepted in MySql , MsSql , Oracle and Sqlite (see Adofuncs.prg)
Some defines are accepted in the syntax as :
[Fld2] TynyInt
where TynyInt comes from adoDef.ch : #define adTinyInt 16
(removing ad)
Is it safe to use this defines this way for all the DNS ?
Or
1) must we create a table as :
ADO MSSQL MYSQL ORACLE SQLITE
16 TinyInt TinyInt TinyInt TinyInt TinyInt
If so , where can i find this field definitions ?
Or
2) Can the field definition be made with the numeric var (16 in this example)
Frank
|
Ado : Field Definition
|
Different RDBSs have different field types. Not all field types are available in all Databases. We need to learn about every Database and choose appropriate field types of that Database to create tables. Typically we need to write an sql statement with the field specifications to create a table and execute the sql statement. If we write an application to work with different databases, we need to write conditionally different sql statements.
FW Ado functions simplify this task. We can use the function:
FWAdoCreateTable( cTable, aCols, oConnectionObject, [lAddAutoInc] ) --> lSuccess
where aCols is a structure exactly like DBSTRUCT() of DBF tables.
This function detects the database from the "oConnectionObject" and chooses appropriate field types and specs and generates sql statement suitable for that database. As of now, this function can handle MSACCESS, MYSQL, SQLITE, MicrosoftSQL, ORACLE for this purpose.
|
Ado and MS Sql
|
Hello,
I use a record set to display a table of Customer from a MS SQL database.
I do not want to use autoedit .
When the user dblclick on a line, i open a dialog and ask FirstName,LastName, PhoneNumber.
When the user click on save, i can do an UPDATE SQL instruction but when i come back in the XBROWSE, the new value is not Displayed .
I can do a REQUERY but the record pointer goes on top of XBrowse
The second way is to close the Dialog and do : oRs:Fields("fieldname"):Value := 'MyValue' oRs:Update() .
What is the best way ?
With standard DBF, we REPLACE the field with new value, come back in the Xbrowse and make a REFRESH .
Thanks
|
Ado and MS Sql
|
Please try
[code=fw:2ughw170]<div class="fw" id="{CB}" style="font-family: monospace;">oBrw:<span style="color: #000000;">bLDClickDatas</span> := <span style="color: #000000;">{</span> || oBrw:<span style="color: #000000;">EditSource</span><span style="color: #000000;">(</span> .f., <span style="color: #ff0000;">"FirstName,LastName,PhoneNumber"</span>, .f. <span style="color: #000000;">)</span><span style="color: #000000;">}</span></div>[/code:2ughw170]
XBrowse internally invokes TDataRow class to edit the contents of the fields and save them properly and update xbrowse.
I assume the recordset fieldnames are FirstName, LastName and PhoneNumber.
|
Ado and MS Sql
|
Jack
A simple oLbx:ReFresh() will work .. you can place it at the bottom of your dialog edit .. consider this code :
[code=fw:1kkmg6ga]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />oLbx:<span style="color: #000000;">bLDblClick</span> := <span style="color: #000000;">{</span> |nRow,nCol | _InvtView<span style="color: #000000;">(</span> <span style="color: #ff0000;">"V"</span>, oWnd, oWndChildA, oRsInvt,oLbx,;<br /> oBtn1,oBtn2,oBtn3,oBtn4,oBtn5,oBtn6,oBtn7,oBtn8 <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> </div>[/code:1kkmg6ga]
As you can see I am passing the oLbx object and when just before I return from _InvView() I do oLbx:ReFresh() .. Hope that helps.
Rick Lipkin
[code=fw:1kkmg6ga]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"DateIssued"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := dDateIssued<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Lname"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cLname<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Fname"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cFname<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"FullName"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cFullName<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"UserId"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cUserId<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Location"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cLoc<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Department"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cDept<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Category"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cCat<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Manufacturer"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cMan<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Asset"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cAsset<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"SerialNumber"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cSerialNumber<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Specs"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cSpecs<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"RetroFitSSD"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cSSD<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Phone"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cPhone<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Cost"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := nCost<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"DatePurchased"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := dDatePurch<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Comments"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cComments<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"EntryBy"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := xLogin<br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"EntryDate"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := dtoc<span style="color: #000000;">(</span>date<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>+<span style="color: #ff0000;">" "</span>+time<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Status"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span> := cStatus<br /><br />oRsInvt:<span style="color: #0000ff;">Update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /><span style="color: #00C800;">If</span> cMode = <span style="color: #ff0000;">"A"</span>.or. cMode = <span style="color: #ff0000;">"E"</span><br /><br /> <span style="color: #00C800;">If</span> cMode = <span style="color: #ff0000;">"E"</span><br /> nEId := oRsInvt:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"InventEid"</span><span style="color: #000000;">)</span>:<span style="color: #000000;">Value</span><br /> <span style="color: #00C800;">Endif</span><br /><br /> oRsInvt:<span style="color: #000000;">Filter</span> := <span style="color: #ff0000;">""</span><br /> oRsInvt:<span style="color: #000000;">Sort</span> := <span style="color: #ff0000;">"Lname"</span><br /> oRsInvt:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oRsInvt:<span style="color: #000000;">Find</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"[InventEid] = "</span>+ltrim<span style="color: #000000;">(</span>str<span style="color: #000000;">(</span>nEid<span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">If</span> oRsInvt:<span style="color: #000000;">eof</span><br /> oRsInvt:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /><span style="color: #00C800;">Endif</span><br /><br />oLbx:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// refresh browse with new or edited data</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span><span style="color: #00C800;">NIL</span><span style="color: #000000;">)</span><br /> </div>[/code:1kkmg6ga]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.