topic
stringlengths
1
63
text
stringlengths
1
577k
function that return the temp directory of the logged user
Thans Philippe Jacquet
function that return the temp directory of the logged user
Philippe, Enrico's solution won't always work. Here is a more comprehensive solution. James [code:3bae7a3e]//--- Returns temporary directory name without trailing backslash function getTempDir() local cDir := GetEnv("TEMP") if empty(cDir) cDir := GetEnv("TMP") endif if Right( cDir, 1 ) == "\" cDir := SubStr( cDir, 1, Len( cDir ) - 1 ) endif if !empty(cDir) if !lIsDir(cDir) cDir := GetWinDir() endif else cDir := GetWinDir() endif return cDir[/code:3bae7a3e]
function that return the temp directory of the logged user
Hi James. I think your code is incomplete. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> It may so occur that there are defined two variables TEMP and TMP in environment. For example TEMP=C:\TEMP and TMP=C:\TMP while directory C:\TEMP does not exist but directory C:\TMP does exist. In this case I think directory C:\TMP should be used instead of GetWinDir(). Vladimir Grigoriev
function that return the temp directory of the logged user
Maybe something as the following <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> //--- Returns temporary directory name without trailing backslash function GetTempDir() local cTargetDir, cTempDir, cTmpDir local lTempExist, lTmpExist cTempDir := GetEnv( "TEMP" ) cTmpDir := GetEnv( "TMP" ) if ( Right( cTempDir, 1 ) == "\" ) cTempDir := SubStr( cTempDir, 1, Len( cTempDir ) - 1 ) endif if ( Right( cTmpDir, 1 ) == "\" ) cTmpDir := SubStr( cTmpDir, 1, Len( cTmpDir ) - 1 ) endif lTempExist := .F. if ( !empty( cTempDir ) ) if ( IsDir(cTempDir ) ) lTempExist := .T. endif endif lTmpExist := .F. if ( !empty( cTmpDir ) ) if ( IsDir(cTmpDir ) ) lTmpExist := .T. endif endif do case case ( lTempExist ) cTargetDir := cTempDir case ( lTmpExist ) cTargetDir := cTmpDir otherwise cTargetDir := GetWinDir() endcase return ( cTargetDir )
function that return the temp directory of the logged user
Vladimir, Thanks for the improvement. James
function that return the temp directory of the logged user
Also the statement if ( Right( cTempDir, 1 ) == "\" ) cTempDir := SubStr( cTempDir, 1, Len( cTempDir ) - 1 ) endif is not correct enough. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> The following would be more correct. if ( ( Right( cTempDir, 1 ) == "\" ) .AND. ! ( Right( cTempDir, 2 ) == ":\" ) ) cTempDir := SubStr( cTempDir, 1, Len( cTempDir ) - 1 ) endif Vladimir Grigoriev
function that return the temp directory of the logged user
[quote="James Bott":vjw7efpf]Enrico's solution won't always work.[/quote:vjw7efpf] I used GetEnv( "TEMP" ) for at least 10 years and got no reports about problems with it. EMG
function that return the temp directory of the logged user
Enrico Maria [quote:29veq1l8]I used GetEnv( "TEMP" ) for at least 10 years and got no reports about problems with it. [/quote:29veq1l8] It is very boring! <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
function that return the temp directory of the logged user
Enrico, Yea, like Valdimir says, thats too easy. I suppose if getEnv("TEMP") returns a blank string then any temp files will just be written to the current directory. There probably won't be any error message. I'm not saying there is anything wrong with that, just that you probably wouldn't know if it was not working as expected. James
function that return the temp directory of the logged user
If GetEnv( "TEMP" ) should have return an empty string then I would consider more correct to put temporary files in the current directory rather than in WINDOWS directory. EMG
function that return the temp directory of the logged user
Enrico, I agree. I didn't write the function I posted, I just had it in my notes. I never really carefully looked at what it was doing. James
function that return the temp directory of the logged user
Enrico Mario [quote:157ttlnr]I would consider more correct to put temporary files in the current directory[/quote:157ttlnr] Buon girno. In the current directory or in a directory from which your program started? Vladimir Grigoriev
function that return the temp directory of the logged user
In the current directory (that is the one from which my program started, in my environment). EMG
function that return the temp directory of the logged user
Enrico, There is a downside to putting temp files in the current directory when the program is being run from a server. This slows down the application. It might be better (when TEMP isn't found) to check for c:\temp and if it doesn't exist, then create it and use this instead. I know most Windows versions have a c:\windows\temp but some versions have security which won't allow users write access to it. There is also an upside to using the server to hold temp files, and that is that any orphan temp files can be periodically deleted either by the application or an administrator. James
function that return the temp directory of the logged user
Agreed. EMG
function that return the temp directory of the logged user
After reading I can conclude that idea to have a program parameter which specifies a temp directory (for example, MyProg /TMP:c:\somepath) deserves consideration. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
function that return the temp directory of the logged user
Or you can use the following API call to get the windows temp folder IF they have access to it. function get_temp() local tbuffer:=space(256) gettemppath(256,@tbuffer) tbuffer := LEFT(tbuffer,AT(CHR(0),tbuffer)-1) return(tbuffer) DLL32 Function GetTempPath( bufferlen as LONG, tbuffer AS LPSTR) AS LONG ; PASCAL FROM "GetTempPathA" LIB "kernel32.dll"
function to build filters
Hello friends, I'm looking for a function to filter in a dbf, that allows for various conditions, and or in the subsequent conditions, different operators, etc., so that the user can be dynamically building the filter. Is there anything ?. Thank you very much and happy 2015.
function to build filters
[code=fw:6lyhabrt]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> ... <span style="color: #0000ff;">TO</span> ... <span style="color: #00C800;">FOR</span> cCondition</div>[/code:6lyhabrt] EMG
function to build filters
I mean the dialog with field, operator and condition... function that processs and verifies the condition, operator and field type...
function to build filters
Lucas, I don't know, sorry. EMG
function to build filters
No problem. It also can be paid.
function to build filters
Have you checked fivedbu ?
function to build filters
Yes but that routine is not finished, Does not verify expresions, field types and operators...
function to build filters
Lucas, you can test them using TRY/CATCH/END. EMG
function to build filters
Two years ago I asked to insert on xbrowse a small filter to use on xbrowse easy. After some work ( it is was not a interest for anyone) I made a small Class Tfilter to use with xbrowse [img:2pwjwdrw]http&#58;//www&#46;eoeo&#46;it/wp-content/uploads/2015/01/FILTER&#46;jpg[/img:2pwjwdrw] the procedure need only the obrw object and the procedure save on memory : fields,Headers and type of fields and with this data you can create the filter as you can see on picture You can save all filter created on ini file and call from your procedure easy It save on file ini if you want try it send to me a msg.
function to build filters
Yes please
function to build filters
Can you send me the class? That's exactly what I'm looking for a long time. Thank You! Manfred
function to build filters
Me too please <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> . Or maybe it´s better to post in the forums, as the Rating class. In my opinion, this class TFilter is more useful and we should help Silvio to debug it!!!!.
function to build filters
this week I recompiled my sources and I found a strange error nEditTypes .. I dont Know I asked to Nages
function to build filters
Sorry ...I found the error give me this tonight to recompiled all sources and make some tries ...
function to build filters
Great, thank you Silvio. If you post here the samples, several people can help to test it.
function to build filters
I sent all sources to Antonio upload on downlist folder Tfilter class FileManager and two samples It is easy to undestand it . oFilter:= TFilter():New(aCampos,aTitulos,aTipos, cDbf,oGrid,lNew,cSection) oFilter:Dialog() oFilter:Activate() cFilter := oFilter:SetFilter() IF ! Empty( cFilter) SET FILTER TO &cFilter (cDbf)->( dbGoTop() ) oGrid:refresh() Endif
function to build filters
Thank You Silvio!!! I wait for the sources!!!!
function to build filters
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=29924&p=170166#p170166">viewtopic.php?f=3&t=29924&p=170166#p170166</a><!-- l -->
function to create a string
Is there a function to save a string like "30/60/90" from an array? i.e. to create an array I made aData := hb_ATokens(cString,"/") Does the reverse function exist?
function to create a string
No conozco una que te devuelva la inversa, pero podrias usar algo asi: [code=fw:3n97akly]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><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;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> cString := <span style="color: #ff0000;">"30/60/90"</span>, aData := hb_ATokens<span style="color: #000000;">&#40;</span>cString,<span style="color: #ff0000;">"/"</span><span style="color: #000000;">&#41;</span><br /><br />cString := <span style="color: #ff0000;">""</span><br />AEval<span style="color: #000000;">&#40;</span>aData, <span style="color: #000000;">&#123;</span>|a| cString := cString + a + <span style="color: #ff0000;">"/"</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><br />cString := <span style="color: #0000ff;">substr</span><span style="color: #000000;">&#40;</span>cString,<span style="color: #000000;">1</span>,len<span style="color: #000000;">&#40;</span>cString<span style="color: #000000;">&#41;</span><span style="color: #000000;">-1</span><span style="color: #000000;">&#41;</span><br /><br />? cString<br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br />&nbsp;</div>[/code:3n97akly]
function to create a string
[code=fw:3ic7k52r]<div class="fw" id="{CB}" style="font-family: monospace;">cStr := FW_ArrayAsList<span style="color: #000000;">&#40;</span> aData, <span style="color: #000000;">&#91;</span>cDelim<span style="color: #000000;">&#93;</span>, <span style="color: #000000;">&#91;</span>lTrim<span style="color: #000000;">&#93;</span></div>[/code:3ic7k52r] In this case: [code=fw:3ic7k52r]<div class="fw" id="{CB}" style="font-family: monospace;">aData := FW_ListAsArray<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"30/60/90"</span>, <span style="color: #ff0000;">"/"</span> <span style="color: #000000;">&#41;</span><br />? aData<br />cStr := FW_ArrayAsList<span style="color: #000000;">&#40;</span> aData, <span style="color: #ff0000;">"/"</span> <span style="color: #000000;">&#41;</span></div>[/code:3ic7k52r] Eg. [code=fw:3ic7k52r]<div class="fw" id="{CB}" style="font-family: monospace;">? cStr := FW_ArrayAsList<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> Date<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">"TEXT &nbsp; &nbsp; &nbsp; "</span>, <span style="color: #000000;">234.56</span> <span style="color: #000000;">&#125;</span>, <span style="color: #ff0000;">";"</span>, .T. <span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">//--> "12-12-2023;TEXT;234.56"</span></div>[/code:3ic7k52r]
function to create a string
I was convinced there was a function that did the opposite but I really didn't remember, thanks everyone for the help
function to create a string
Muchas gracias Mr Rao... Desde que version de Fivewin existen esas funciones?
function to create a string
February 2013. More than 10 years back. These functions are in \source\function\valtostr.prg. These functions are extensively used by FWH in its own modules (around 16 modules)
function to create a string
Excelente! Muchas gracias Mr. Rao!!
function to create tables for Access and MySQL
Hello, As the sintax is different, is there a function to créate tables for either Access or MySQL?. Thank you.
function to create tables for Access and MySQL
Lucas, [quote="lucasdebeltran":2mx2rbj3]Hello, As the sintax is different, is there a function to créate tables for either Access or MySQL?. Thank you.[/quote:2mx2rbj3] This is the function I'm using: [code=fw:2mx2rbj3]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> ADDTABLE<span style="color: #000000;">&#40;</span> cMot, cTab, aFld <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> cQuery := <span style="color: #ff0000;">"CREATE TABLE "</span> + cTab + <span style="color: #ff0000;">" ( "</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> cType<br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> i<br /><br />&nbsp; &nbsp; <span style="color: #00C800;">IF</span> cMot == <span style="color: #ff0000;">"JET"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; cQuery += <span style="color: #ff0000;">"Id COUNTER PRIMARY KEY, "</span><br />&nbsp; &nbsp; ELSEIF cMot == <span style="color: #ff0000;">"MSSQL"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; cQuery += <span style="color: #ff0000;">"Id INT IDENTITY PRIMARY KEY, "</span><br />&nbsp; &nbsp; ELSEIF cMot == <span style="color: #ff0000;">"MYSQL"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; cQuery += <span style="color: #ff0000;">"Id SERIAL, "</span><br />&nbsp; &nbsp; <span style="color: #00C800;">ENDIF</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">FOR</span> i = <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">&#40;</span> aFld <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; cType = aFld<span style="color: #000000;">&#91;</span> i, DBS_TYPE <span style="color: #000000;">&#93;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">DO</span> <span style="color: #00C800;">CASE</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">CASE</span> cType = <span style="color: #ff0000;">"C"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cQuery += aFld<span style="color: #000000;">&#91;</span> i, DBS_NAME <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" VARCHAR ( "</span> + NTRIM<span style="color: #000000;">&#40;</span> aFld<span style="color: #000000;">&#91;</span> i, DBS_LEN <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">" ), "</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">CASE</span> cType = <span style="color: #ff0000;">"N"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cQuery += aFld<span style="color: #000000;">&#91;</span> i, DBS_NAME <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" NUMERIC ( "</span> + NTRIM<span style="color: #000000;">&#40;</span> aFld<span style="color: #000000;">&#91;</span> i, DBS_LEN <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">", "</span> + NTRIM<span style="color: #000000;">&#40;</span> aFld<span style="color: #000000;">&#91;</span> i, DBS_DEC <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">" ), "</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">CASE</span> cType = <span style="color: #ff0000;">"D"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cQuery += aFld<span style="color: #000000;">&#91;</span> i, DBS_NAME <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" DATETIME, "</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">CASE</span> cType = <span style="color: #ff0000;">"L"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cQuery += aFld<span style="color: #000000;">&#91;</span> i, DBS_NAME <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" INT, "</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">CASE</span> cType = <span style="color: #ff0000;">"M"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">IF</span> cMot == <span style="color: #ff0000;">"JET"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cQuery += <span style="color: #ff0000;">"["</span> + aFld<span style="color: #000000;">&#91;</span> i, DBS_NAME <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">"]"</span> + <span style="color: #ff0000;">" MEMO, "</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ELSEIF cMot == <span style="color: #ff0000;">"MSSQL"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cQuery += <span style="color: #ff0000;">"["</span> + aFld<span style="color: #000000;">&#91;</span> i, DBS_NAME <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">"]"</span> + <span style="color: #ff0000;">" TEXT, "</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ELSEIF cMot == <span style="color: #ff0000;">"MYSQL"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cQuery += aFld<span style="color: #000000;">&#91;</span> i, DBS_NAME <span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">" TEXT, "</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">ENDIF</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">ENDCASE</span><br />&nbsp; &nbsp; <span style="color: #00C800;">NEXT</span><br /><br />&nbsp; &nbsp; cQuery = STRIM<span style="color: #000000;">&#40;</span> cQuery, <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">" )"</span><br /><br />&nbsp; &nbsp; SQLEXEC<span style="color: #000000;">&#40;</span> cQuery <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:2mx2rbj3] EMG
function to create tables for Access and MySQL
Enrico, Where are functions STrim(), NTrim() and SqlExec() ? thanks
function to create tables for Access and MySQL
Antonio, [quote="Antonio Linares":1s0oi8p4]Enrico, Where are functions STrim(), NTrim() and SqlExec() ? thanks[/quote:1s0oi8p4] [code=fw:1s0oi8p4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#define</span> STRIM<span style="color: #000000;">&#40;</span> cStr, nChr <span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span> cStr, Len<span style="color: #000000;">&#40;</span> cStr <span style="color: #000000;">&#41;</span> - nChr <span style="color: #000000;">&#41;</span><br /><span style="color: #00D7D7;">#define</span> NTRIM<span style="color: #000000;">&#40;</span> nNumber <span style="color: #000000;">&#41;</span> LTrim<span style="color: #000000;">&#40;</span> Str<span style="color: #000000;">&#40;</span> nNumber <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">FUNCTION</span> SQLEXEC<span style="color: #000000;">&#40;</span> cQuery <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> cCns := <span style="color: #ff0000;">"Your connectionstring here"</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> oCn := CREATEOBJECT<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ADODB.Connection"</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oCn:<span style="color: #000000;">CursorLocation</span> = adUseClient<br /><br />&nbsp; &nbsp; oCn:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span> cCns <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">&#40;</span> cQuery <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:1s0oi8p4] EMG
function to create tables for Access and MySQL
Mr. Enrico, Thank you very much, but I always get, either MYSQL or MSACCESS: Incorrect arguments, out of range or in conflict with others. (0x800A0BB9) What I am doing wrong?. Thank you.
function to create tables for Access and MySQL
Lucas, [quote="lucasdebeltran":pj5796g4]Mr. Enrico, Thank you very much, but I always get, either MYSQL or MSACCESS: Incorrect arguments, out of range or in conflict with others. (0x800A0BB9) What I am doing wrong?. Thank you.[/quote:pj5796g4] Please, show me how are you calling the function. A reduced and self-contained sample would be better. EMG
function to create tables for Access and MySQL
Mr. Enrico, I have to open the connection using oCn2:CursorLocation = adUseClient. I was using my own Exec function, but in yours is that set on. Now it is working fine. Also, in MySQL, when creating a table, this sets up auto_increment feature and it is managed by MySQL: cQuery += "ID INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY(ID), " What is the equivalent please for MS Access?. For MsAccess, I tried with NO luck: cQuery += "Id INT IDENTITY PRIMARY KEY, " But the auto increment feature is not managed propelly, I always get 0 at the Id field. Anything else to set up?. Thank you. Best regards
function to create tables for Access and MySQL
[quote="lucasdebeltran":2kf8666k]Mr. Enrico, I have to open the connection using oCn2:CursorLocation = adUseClient. I was using my own Exec function, but in yours is that set on. Now it is working fine.[/quote:2kf8666k] I don't understand but ok, that's good. <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> [quote="lucasdebeltran":2kf8666k]Also, in MySQL, when creating a table, this sets up auto_increment feature and it is managed by MySQL: cQuery += "ID INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY(ID), " What is the equivalent please for MS Access?. For MsAccess, I tried with NO luck: cQuery += "Id INT IDENTITY PRIMARY KEY, " But the auto increment feature is not managed propelly, I always get 0 at the Id field. Anything else to set up?. Thank you. Best regards[/quote:2kf8666k] Please look at my function: [code=fw:2kf8666k]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; &nbsp;<span style="color: #00C800;">IF</span> cMot == <span style="color: #ff0000;">"JET"</span><br />&nbsp; &nbsp; &nbsp; &nbsp; cQuery += <span style="color: #ff0000;">"Id COUNTER PRIMARY KEY, "</span></div>[/code:2kf8666k] EMG
function to create tables for Access and MySQL
Mr. Enrico, Thank you, but with your function the result is the same, with Access and ADO autoincrement fields are not managed. With MySQL is fine. Anything else has to be done?. Thanks.
function to create tables for Access and MySQL
Lucas What provider do you use to connect to Mysql with ADO ? Richard
function to create tables for Access and MySQL
Lucas, [quote="lucasdebeltran":pn54g10g]Mr. Enrico, Thank you, but with your function the result is the same, with Access and ADO autoincrement fields are not managed. With MySQL is fine. Anything else has to be done?. Thanks.[/quote:pn54g10g] My function works fine here, even with Access. As I already said, I need a sample of how are you calling it. EMG
function to create tables for Access and MySQL
Mr. Enrico, Thank you very much. Your function works perfect. There is a bug at TDataRow managing Access numeric fields with decimals, not related to your function. Best regards
function to create tables for Access and MySQL
[quote="lucasdebeltran":zmpk2j3n]Mr. Enrico, Thank you very much. Your function works perfect. There is a bug at TDataRow managing Access numeric fields with decimals, not related to your function. Best regards[/quote:zmpk2j3n] Yes, in the case of blank row and it was fixed. You already have the fixed version with you
function to create tables for Access and MySQL
Mr. Nages, In the datarow.prg you sent me on 15th I still get the error. The error only happens with MSACCESS, not with MySQL or MSSQL server. Thank you.
function to create tables for Access and MySQL
Enrico, Does your function support Memo fields ? How do you specify them ? thanks Lucas, I am using Enrico's code here and the Access tables are properly created with the autoinc counter
function to create tables for Access and MySQL
Antonio, [quote="Antonio Linares":2oz28g63]Enrico, Does your function support Memo fields ? How do you specify them ?[/quote:2oz28g63] Yes. Look at [code=fw:2oz28g63]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">CASE</span> cType = <span style="color: #ff0000;">"M"</span></div>[/code:2oz28g63] EMG
function to create tables for Access and MySQL
Mr Enrico's function supports memo fields
function to create tables for Access and MySQL
Antonio, The problema is with DataRow class and Access and numeric fields with decimals, not with Mr. Enrico class. Here is reported: <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=26545">viewtopic.php?f=3&t=26545</a><!-- l --> Mr. Nages is working on it.
function to supress intermediate spaces
Dear friends, Is there a function to remove the intermediate spaces from a string ?. Very grateful;).
function to supress intermediate spaces
Try STRTRAN(var," ","") Good luck
function to supress intermediate spaces
Thanks: function QuitaEspacios( cCadena ) return strtran( cCadena, Space(1), Space(0) )
function to supress intermediate spaces
Also CharRem( <cDelete>, <cString> ) --> cResult Examples CharRem( " ", "One Two Three" ) --> "OneTwoThree" CharRem( "a", "Banana" ) --> "Bnn"
function to supress intermediate spaces
Esta es una función que cambia espacios de mas de uno a uno. lo uso mucho con instrucciones sql. [code=fw:4e69c1be]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> TrimSpace<span style="color: #000000;">&#40;</span> cString <span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> AtNum<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"  "</span>, cString <span style="color: #000000;">&#41;</span> > <span style="color: #000000;">0</span><br />      cString := StrTran<span style="color: #000000;">&#40;</span> cString, <span style="color: #ff0000;">"  "</span>, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">ENDDO</span><br /><br /><span style="color: #00C800;">RETURN</span> cString<br /> </div>[/code:4e69c1be]
function to supress intermediate spaces
I vote for Jack's version: STRTRAN(var," ","") The simpler, the better.
function to supress intermediate spaces
Me too! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> EMG
function to supress intermediate spaces
Carlos Vargas solution is better
function to supress intermediate spaces
[quote="carlos vargas":3lra9ydz]Esta es una función que cambia espacios de mas de uno a uno. lo uso mucho con instrucciones sql. [code=fw:3lra9ydz]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> TrimSpace<span style="color: #000000;">&#40;</span> cString <span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> AtNum<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"  "</span>, cString <span style="color: #000000;">&#41;</span> > <span style="color: #000000;">0</span><br />      cString := StrTran<span style="color: #000000;">&#40;</span> cString, <span style="color: #ff0000;">"  "</span>, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">ENDDO</span><br /><br /><span style="color: #00C800;">RETURN</span> cString<br /> </div>[/code:3lra9ydz][/quote:3lra9ydz] For this purpose you may consider using CHARONE( ' ', cString ) This is a highly optimized function specially meant for removing adjacent duplicate characters. I know the functions i am talking about are less familiar but the character functions of CT are highly optimized functions. Full syntax: CHARONE( [cDelete], cString ) Ex: CharOne( " *-", cStrings ) removes all duplicates of ' ', '*', '-' in one single call.
function to supress intermediate spaces
[quote="nageswaragunupudi":3gkm5yzv][quote="carlos vargas":3gkm5yzv]Esta es una función que cambia espacios de mas de uno a uno. lo uso mucho con instrucciones sql. [code=fw:3gkm5yzv]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> TrimSpace<span style="color: #000000;">&#40;</span> cString <span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> AtNum<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"  "</span>, cString <span style="color: #000000;">&#41;</span> > <span style="color: #000000;">0</span><br />      cString := StrTran<span style="color: #000000;">&#40;</span> cString, <span style="color: #ff0000;">"  "</span>, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">ENDDO</span><br /><br /><span style="color: #00C800;">RETURN</span> cString<br /> </div>[/code:3gkm5yzv][/quote:3gkm5yzv] For this purpose you may consider using CHARONE( ' ', cString ) This is a highly optimized function specially meant for removing adjacent duplicate characters. I know the functions i am talking about are less familiar but the character functions of CT are highly optimized functions. Full syntax: CHARONE( [cDelete], cString ) Ex: CharOne( " *-", cStrings ) removes all duplicates of ' ', '*', '-' in one single call.[/quote:3gkm5yzv] Where I can find this function?
function to supress intermediate spaces
[quote:2cow7id9]Elvira said: Is there a function to remove the intermediate spaces from a string ?[/quote:2cow7id9] [quote:2cow7id9]Nages said: This is a highly optimized function specially meant for removing adjacent duplicate characters.[/quote:2cow7id9] I took Elvira's statement to mean that he want to remove all spaces, but I admit it is not clear. Removing adjacent duplicates is a different task.
function to supress intermediate spaces
Mr James Elvira's first posting was for removing all spaces. StrTran( cString, ' '. '' ) is correct. But CharRem() function specially made for such purposes and more efficient. Mr Carlos Vargas' posting was to remove duplicate adjacent spaces. I suggested CharOne() for this instead of the code he was using. These functions were from the 16-bit Clipper days, included in CA_Tools libaray. At that time, most of these functions were written in Assembly language and highly optimized for speed and size. Now CT.LIB/HBCT.LIB includes all these functions written mostly in C for (x)Harbour. Those of us who still have the old Clipper installation on our discs can find the documentation in \clipper\ng. This documentation requirs ng.exe or weg.exe to read. xharbour.com provided a detailed help file (chm) which contains very good documentation. This is very useful
function to supress intermediate spaces
[quote="nageswaragunupudi":2z2le2vy]But CharRem() function specially made for such purposes and more efficient.[/quote:2z2le2vy] You're right! Look at this sample: [code=fw:2z2le2vy]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> cSpaces := SPACE<span style="color: #000000;">&#40;</span> <span style="color: #000000;">100000000</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">LOCAL</span> nSec := SECONDS<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; cSpaces = STRTRAN<span style="color: #000000;">&#40;</span> cSpaces, <span style="color: #ff0000;">" "</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; ? SECONDS<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> - nSec, LEN<span style="color: #000000;">&#40;</span> cSpaces <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; cSpaces = SPACE<span style="color: #000000;">&#40;</span> <span style="color: #000000;">100000000</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; nSec = SECONDS<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; cSpaces = CHARREM<span style="color: #000000;">&#40;</span> cSpaces, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; ? SECONDS<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> - nSec, LEN<span style="color: #000000;">&#40;</span> cSpaces <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; INKEY<span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span></div>[/code:2z2le2vy] I get this: [code=fw:2z2le2vy]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">1.36</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.00</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span></div>[/code:2z2le2vy] Wow! EMG
function to supress intermediate spaces
Wow! ++++1
function to supress intermediate spaces
EMG, Your computer is fast--2.4 times faster than mine. I get: 3.31 0.03 Either way, charRem() is 100 times faster than strtran(). Thanks Nages. This is only available with xHarbour though?
function to supress intermediate spaces
[quote:38psvbez]This is only available with xHarbour though?[/quote:38psvbez] Both Harbour and xHarbour. We need to link \xharbour\lib\ct.lib for xHarbour and \harbour\lib\hbct.lib for Harbour. If we are using fwh, it means we already have these libs included in our link scripts though we might not have noticed. These libs contain all function of the erstwhile CA-Tools.
function to supress intermediate spaces
Hello, is this a good and save way to remove CRLF form database-fields. Thanks in advance Otto [code=fw:207g2d7s]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">select</span> daten<br />aStruc := DBStruct<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />go top<br /><span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> .not. eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    aRec := getrec<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />    <span style="color: #00C800;">For</span> I := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> len<span style="color: #000000;">&#40;</span> aRec <span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">if</span> aStruc<span style="color: #000000;">&#91;</span>I,<span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span> = <span style="color: #ff0000;">"C"</span><br />        aRec<span style="color: #000000;">&#91;</span>I<span style="color: #000000;">&#93;</span> := CharRem<span style="color: #000000;">&#40;</span> CHR<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span>, aRec<span style="color: #000000;">&#91;</span>I<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><br />        aRec<span style="color: #000000;">&#91;</span>I<span style="color: #000000;">&#93;</span> := CharRem<span style="color: #000000;">&#40;</span> CHR<span style="color: #000000;">&#40;</span><span style="color: #000000;">13</span><span style="color: #000000;">&#41;</span>, aRec<span style="color: #000000;">&#91;</span>I<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> <br />        <span style="color: #00C800;">endif</span><br />    <span style="color: #00C800;">next</span><br />    <br />    <span style="color: #0000ff;">select</span> daten<br />    rlok<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    saverec<span style="color: #000000;">&#40;</span> aRec <span style="color: #000000;">&#41;</span><br />    unlok<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    skip<br /><br /><span style="color: #00C800;">enddo</span><br /><br /><br /> </div>[/code:207g2d7s]
function to supress intermediate spaces
Mr Otto You just need one line [code=fw:2ea7svhh]<div class="fw" id="{CB}" style="font-family: monospace;">        aRec<span style="color: #000000;">&#91;</span>I<span style="color: #000000;">&#93;</span> := CharRem<span style="color: #000000;">&#40;</span> CRLF, aRec<span style="color: #000000;">&#91;</span>I<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><br /> </div>[/code:2ea7svhh] All Chr(13) and all Chr(10) will be removed, even if they are not together. [code=fw:2ea7svhh]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">select</span> daten<br />aFldNo := <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />AEval<span style="color: #000000;">&#40;</span> DbStruct<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #000000;">&#123;</span> |a,i| <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> a<span style="color: #000000;">&#91;</span> <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span> $ <span style="color: #ff0000;">'CM'</span>, AAdd<span style="color: #000000;">&#40;</span> aFldNo, i <span style="color: #000000;">&#41;</span>, <span style="color: #00C800;">nil</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">if</span> .not. Empty<span style="color: #000000;">&#40;</span> aFldNo <span style="color: #000000;">&#41;</span><br />   go top<br />   <span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> .not. eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      rlok<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">for</span> each i in aFldNo<br />         FieldPut<span style="color: #000000;">&#40;</span> i, CharRem<span style="color: #000000;">&#40;</span> CRLF, FieldGet<span style="color: #000000;">&#40;</span> i <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">next</span><br />      DBUNLOCK<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      skip<br />   <span style="color: #00C800;">enddo</span><br /><span style="color: #00C800;">endif</span></div>[/code:2ea7svhh]
functions in fwppc
there are many funcs in fwppc not run ?????cIni :=[b:2n10bt0q]GetWinDir()+"[/b:2n10bt0q]\PalmBeach.Ini" cTem :=[b:2n10bt0q]GetPvProfString[/b:2n10bt0q]("System","DirDat","",cIni) cDir :=IF(!Empty(cTem),[b:2n10bt0q]LFN2SFN[/b:2n10bt0q](cTem),cTem) [b:2n10bt0q] WritePProString[/b:2n10bt0q](cNSys,"DirDat",cPath,cIni)How I can use it ?is there not a tini class ?
functions in fwppc
Silvio,Windows Mobile does not provide all the functions that Windows for PC does.
functions in fwppc
ok i understandI'd like know all function and comand it supportI have difficult to create a application and link it to main pc aplication
functions in fwppc
Silvio,> I'd like know all function and comand it support Then you have to read all Microsoft docs for Windows Mobile and Windows PC <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
functions of the netbios
Hi! I'm to work in Xbase++. It would like to know if somebody knows to inform me which is the process to use the functions of the netbios in XBase++ (NbReset(), nbAddName(), etc). The necessary library must be invoked well because it recognizes the functions. But it is not to connect, or either, for example, when making nbReset(), it returns false. When making nbError(), the emitted error is nº 35 ("Invalid Adapter"). I don´t understand because it does not function. If somebody could help to discover me reason was thankful. Thanks <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
functions of the netbios
You may review FW++ source\winapi\netapi32.prg
functions sin and cos
Hello, I am trying to compile a my program that uses the trigonometric functions sin and cos, the problem is the linker says that both are already defined in FiveH32.lib... I see the file selector.prg has an implementation of them <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> ... From my knowledge they are defined in assembler, why is there a re-implementation ? they cover the standard one, I bet they are slower... Antonino
functions sin and cos
Can I see a sample of the problem? EMG
functions sin and cos
Antonino, We are going to rename them as FWSIN and FWCOS thanks for pointing it
functions sin and cos
Enrico, Functions Sin() and Cos() are already defined in Harbour hbct.lib
functions sin and cos
[quote="Enrico Maria Giordano":pfqtnywz]Can I see a sample of the problem? EMG[/quote:pfqtnywz] I am using Visual studio 2017 with harbour: [img:pfqtnywz]https&#58;//i&#46;imgur&#46;com/NZlTiKc&#46;jpg[/img:pfqtnywz] [quote="Antonio Linares":pfqtnywz]Antonino, We are going to rename them as FWSIN and FWCOS thanks for pointing it[/quote:pfqtnywz] Ok, in the meantime I will change my version of FiveWin
functions sin and cos
Ok, good to know, thank you. EMG
functions sin and cos
How to get the same message from BCC? EMG
functions sin and cos
xHarbour's ct.lib or Harbour's hbct.lib provides all the functions provided earlier by CA-Tools library in the good old Clipper days. These functions include Trigonometric functions: ACOS(), ASIN(), ATAN(), ATN2(), COS(), COSH(), COT(), DTOR(), GETPREC(), SETPREC(), PI(), RTOD(), SIN(), SINH(), TAN(), TANH()
funzione SEEK
Enrico, hai un esempio di utilizzo di seek per adordd con SQL? grazie?
funzione SEEK
Ammesso e non concesso che ADORDD funzioni, non dovrebbe essere differente dalla normale SEEK. EMG
função DLL demora e sistema parece estar travado
Ola pessoal, Eu chamo do meu sistema uma função de uma DLL de uma impressora fiscal, ex: Bematech_FI_ArquivoMFD("", xIni, xFim, cTipo, "01", 2, cPublica, cPrivada, 1) O problema é que esta função demora cerca de 5 minutos até terminar de ler os dados, e, o sistema parece estar travado . Tentei colocar um TIMER para de tempo em tempo forçar um SYSREFRESH(), mais não funcionou. Alguem tem alguma idéia de como resolver? Obrigado
função DLL demora e sistema parece estar travado
Ola amigo Tudo joia Seguinte, dependendo do período que vc informou, e a quantidade de movimentações que existam na ECF, pode levar até mais tempo que isso, já fiz um relatório aqui para SEFAZ do meu estado em uma ECF FISCNET da ELGIN que levou 7 dias, e foi de apenas 1 ano, mais o cliente vendia em media neste ECF cerca de R$ 15.000,00 dia, então já da para imaginar a quantidade de dados que tinha nesta ECF. Espero ter ajudado
fusionar tablas...
Hola a todos... Tengo un problema... Vamos a ver, tengo que "unir" varias tablas en una sola. En FOX utiliza un select ...from.... que te permite guardar la seleccion en un cursor o tabla temporal. He buscado mucho por ahi y lo único que he encontrado que dicen que funciona es la instrucción join with... que se supone que une la tabla que está activa con otra por medio de su alias y lo guarda en una tabla nueva siempre que se cumpla la condicion y ademas se pueden elegir los campos que se quieren guardar. Lo estoy utilizando así: use(ruta_base+'precios.dbf') new INDEX ON articulo TO precios aliasPrecios:=ALIAS() use(ruta_base+'articulo.dbf') new INDEX ON codart TO articulo aliasArticulo:=ALIAS() &&temp es la tabla temporal en la que voy a guardar la seleccion &&precios es la tabla que no está activa.. join with aliasPrecios to temp for aliasPrecios->articulo=articulo->codart fields * USE (ruta_base+'temp.dbf') new COPY TO (CURDIR()+"\temporal.dbf") COPY TO (CURDIR()+"\temporal.cdx") Pero a mi no me funciona.. No me da error pero no me guarda nada... Alguien puede echarme una mano con esto, o indicarme otra forma de hacerlo,me urge y estoy estancado... Saludos y gracias.. Elías Torres.
fw + mysql + ado
Hola, Estoy haciendo un sistemita basico con FW y MYSQL. Ya tengo la conexion con ODBC y puedo conectarme y leer datos. lo que no puedo hacer es actualizar datos... alguien tiene algun ejemplo basico de como actualizar datos utilizando variables del programa en FW y pasandolas a algo como esto ? csql:="UPDATE prontuario set c11 = ' "+ STR(CANT) + " ' where cod = ' CODINST ' " he visto que estan mencionando ADO como una mejor solucion para accesor BD SQl. 1.- Se puede usar con FW ? 2.- Alguien tiene un ejemplo de los pasos basicos ? -- abrirla -- consultar -- actualizar por medio de bsuquedas etc... Gracias
fw + mysql + ado
RMC Ejemplo: Completo *- *- Programa : CAT_USU.PRG *- Sistema : Nombre del Sistema *- Ambiente : Clipper 5.X, FiveWin 1.95, Blinker 3.2 *- Autor : Sistemas 2002 *- Fecha : 08/11/04 *- Versión : Versión Genera 1.0, <!-- e --><a href="mailto:nazariosn@yahool.com.mx">nazariosn@yahool.com.mx</a><!-- e --> *- #INCLUDE 'FIVEWIN.CH' // Cabezera de FW #INCLUDE 'REPORT.CH' // Cabezera de Reportes #include "sql.ch" #include "error.ch" STATIC oLbx, oDlg // oLbx=Browser, oDlg=Datos STATIC lEsAlta,; // Para el control de los Botones Activar/NoActivar lEsModi,; // Para el control de los Botones Activar/NoActivar lNoEdita,; // Para el control de los Botones Activar/NoActivar lGuarda // Para el control de los Botones Activar/NoActivar STATIC oGets,; // Optimizar el uso de la memoria, arreglo de Objetos para los Gets oObjs,; // Optimizar el uso de la memoria, arreglo de Objetos para los Objetos oSays,; // Optimizar el uso de la memoria, arreglo de Objetos para los Says oBtns,; // Optimizar el Uso de los Botones aRec // Coordenadas del Calendario, Ing. Alfredo Arteaga STATIC T_Dir, T_Num //------------------------------------------------------------------ FUNCTION CAT_USU(oOdbc) LOCAL ocurDedo LOCAL criterio := "SELECT * from Cat_USU Order By mater,juzas" LOCAL oQuery LOCAL Puntero:=oOdbc DEFINE CURSOR oCurDedo RESOURCE "Dedo" lEsAlta:=.F. lEsModi:=.F. lNoEdita:=.F. lGuarda:=.F. oGets :=ARRAY(3) oObjs :=ARRAY(3) oSays :=ARRAY(3) oBtns :=ARRAY(12) oQuery := oOdbc:Query(criterio) // lDateAsStr := .t., Formato de Fecha "AAAA/MM/DD" oQuery:lDateAsStr := .f. oQuery:Open() oQuery:Complete() oQuery:Gotop() DEFINE DIALOG oDlg RESOURCE "CAT_USU" // DEFINICION DE BOTONES REDEFINE BTNBMP oBtns[01] ID 1000 OF oDlg RESOURCE "Nuevo2" ; TOOLTIP "Registro Nuevo" NOBORDER ; ACTION ( IniCUSU(oLbx) ) When !lEsModi REDEFINE BTNBMP oBtns[02] ID 2000 OF oDlg RESOURCE "Cambia2"; TOOLTIP "Modifica Registro" NOBORDER ; ACTION ( CarCUSU(oLbx), lEsModi:=.T. ) when !lEsAlta // CRLF=Salto de Linea // MsgYesNo()=Mensaje y pide confirmaci½n, si/no // Antes de borrar comprobar que no hay ningún movimiento contable REDEFINE BTNBMP oBtns[03] ID 3000 OF oDlg RESOURCE "Borra2" ; TOOLTIP "Elimina Registro" NOBORDER ; ACTION (oQuery:=BorraCUSU(oODBC,oLbx),oQuery:Complete(),oQuery:GoBottom(),CarCUSU(oLbx) ); when !lEsAlta .AND. !lEsModi *IF(MsgYesNo("¿ Deseas borrar éste Registro ? : "+CRLF+CRLF,"Confirma"),.T.,.T. ); REDEFINE BTNBMP oBtns[04] ID 4000 OF oDlg RESOURCE "Busca2"; TOOLTIP "Buscar registro" NOBORDER ; ACTION ( BusCUSU(oLbx)) when !lEsAlta .AND. !lEsModi REDEFINE BTNBMP oBtns[05] ID 5000 OF oDlg RESOURCE "Inicio1" TOOLTIP "Primer Registro" NOBORDER ; ACTION ( oQuery:Gotop(), CarCUSU(oLbx) ) ; WHEN !lEsAlta .AND. !lEsModi REDEFINE BTNBMP oBtns[06] ID 6000 OF oDlg RESOURCE "Antes1" TOOLTIP "Anterior Registro" NOBORDER ; ACTION ; ( oQuery:Skip(-1),CarCUSU(oLbx) ) ; WHEN !lEsAlta .AND. !lEsModi REDEFINE BTNBMP oBtns[07] ID 7000 OF oDlg RESOURCE "Despues1" TOOLTIP "Siguiente Registro" NOBORDER ; ACTION ( oQuery:Skip(+1),CarCUSU(oLbx) ) ; WHEN !lEsAlta .AND. !lEsModi REDEFINE BTNBMP oBtns[08] ID 8000 OF oDlg RESOURCE "Final1" TOOLTIP "Ultimo Registro" NOBORDER ; ACTION ( oQuery:GoBottom(),CarCUSU(oLbx) ) ; WHEN !lEsAlta .AND. !lEsModi REDEFINE BTNBMP oBtns[09] ID 9000 OF oDlg RESOURCE "Imprime2" TOOLTIP "Imprimir Catálogo" NOBORDER ; ACTION (oQuery:=ImprimeCUSU(oODBC),oQuery:Complete()) when !lEsAlta .AND. !lEsModi REDEFINE BTNBMP oBtns[10] ID 10000 OF oDlg RESOURCE "Disco2" TOOLTIP "Guardar Datos" NOBORDER ; ACTION ; ( lGuarda:=.T., IF(VALCUSU1(oODBC,oGets[1],oGets[2],oGets[3]),.t.,oQuery:=GuardaCUSU(oODBC, oLbx)),oQuery:Complete(),oQuery:GoBottom(),CarCUSU(oLbx) ); WHEN lEsAlta .Or. lEsModi REDEFINE BTNBMP oBtns[11] ID 11000 OF oDlg RESOURCE "Cancela2" TOOLTIP "Cancelar Captura" NOBORDER ; ACTION ; (IniCUSU(oLbx), CarCUSU(oLbx), lGuarda:= .F.,lEsAlta:=.F.,lEsModi:=.F.) REDEFINE BTNBMP oBtns[12] ID 12000 OF oDlg RESOURCE "Salida1","Salida2" TOOLTIP "Regresar" NOBORDER; ACTION ( oDlg:End() ) // // LISTBOX, SÓLAMENTE USAR CUANDO SEA NECESARIO // El uso de Fechas y Números, Convertir a Caracter para mostralos // *REDEFINE LISTBOX oLbx FIELDS ; * ON CHANGE ( CarCUSU(oLbx), lGuarda:=.F., lEsAlta:=.F., lEsModi:= .F. ); * ID 1013 OF oDlg * * oLbx:aJustify := {.F., .F.} // Justificaci¢n de Cabezeras IZQ, .T.=Centro * oLbx:nLineStyle:=2 // Separador de datos * oLbx:Refresh() // Estabiliza el browse/listbox // ( Pinta los datos nuevamente ) // Muestra la descripción Correctamente de los SAY´S REDEFINE SAY ID 1 OF oDlg REDEFINE SAY ID 2 OF oDlg REDEFINE SAY ID 3 OF oDlg // Muestra la descripción Correctamente de los GET´S REDEFINE GET oObjs[1] VAR oGets[1] ID 101 OF oDlg PICTURE "@!"; When lEsAlta REDEFINE GET oObjs[2] VAR oGets[2] ID 102 OF oDlg PICTURE "99"; When lEsAlta .and. !empty(oGets[1]) REDEFINE GET oObjs[3] VAR oGets[3] ID 103 OF oDlg PICTURE "@!"; When lEsAlta .OR. lEsModi * VALID !VALCUSU1(oODBC,oGets[1],oGets[2],oGets[3]); ACTIVATE DIALOG oDlg CENTER ON INIT CarCUSU(oLbx) RETURN Puntero //------------------------------------------------------------------ Function ValCUSU1(oODBC,materia, juzgado,dire) *LOCAL criterioVal := "SELECT mater,juzas FROM Cat_USU WHERE mater='" + alltrim(materia)+"'" + " and juzas =" + alltrim(str(juzgado))+; * ' and direccion = "'+ alltrim(dire)+'"' Local criterioVal := "SELECT mater,juzas FROM Cat_USU WHERE direccion = '"+ alltrim(dire)+"'" LOCAL oQueryVal LOCAL encontre:=.F. LOCAL SiHay:=0 oQueryVal := oOdbc:Query(criterioVal) oQueryVAL:Open() oQueryVAL:Complete() oQueryVal:GoTop() SiHay:=oQueryVal:RecCount() oQueryVal:End() * Msginfo(sihay) If SiHay >0 encontre:=.T. MsgInfo("La Dirección YA EXISTE"," Verifica . . . :"+Materia+ ", "+Alltrim(str(juzgado))) Else encontre:=.F. EndIF Return encontre //------------------------------------------------------------------ Static Function BorraCUSU(oODBC,oLbx) LOCAL BorraCriterio := 'DELETE FROM Cat_USU WHERE mater = "' + alltrim(oGets[1])+'"'+ ' and juzas =' + alltrim(str(oGets[2])) +; ' and direccion = "'+ t_dir + '" and numero = "'+t_num+'"' LOCAL XCriterio:="SELECT * from Cat_USU Order By mater, juzas" LOCAL oQuery LOCAL correcto IF !oOdbc:Execute(BorraCriterio,"DELETE",,correcto) MsgAlert("Error al Eliminar en el Catálogo de Usuarios") EndIF oQuery := oOdbc:Query(xcriterio) // lDateAsStr := .t., Formato de Fecha "AAAA/MM/DD" oQuery:lDateAsStr := .f. oQuery:Open() oQuery:Complete() oQuery:GoBottom() IniCUSU(oLbx) lGuarda:= .F. lEsAlta:=.F. lEsModi:=.F. *oLbx:Refresh() Return oQuery //------------------------------------------------------------------ Static Function GuardaCUSU(oODBC,oLbx) LOCAL AltaCriterio LOCAL ModiCriterio LOCAL XCriterio:="SELECT * from Cat_USU Order By mater,juzas" LOCAL oQueryReg LOCAL correcto LOCAL oQuery ? ALLTRIM(oGets[1]) ? oGets[2] IF !Empty(oGets[1]) .AND. oGets[2] >0 AltaCriterio := 'INSERT INTO Cat_USU (mater,juzas,direccion,numero) values ("' + alltrim(oGets[1]) + '",'+; alltrim(str(oGets[2])) +',"' + alltrim(oGets[3])+'","NOHAY")' ModiCriterio := 'UPDATE Cat_USU SET direccion= "' + alltrim(oGets[3]) + '", numero= "NOHAY"' +; ' WHERE mater = "' + alltrim(oGets[1])+'"'+ ' and juzas = ' + alltrim(str(oGets[2])) +; ' and direccion = "'+ t_dir + '" and numero = "'+t_num+'"' IF lGuarda IF lEsAlta msginfo(altacriterio) IF !oOdbc:Execute(AltaCriterio,"INSERT",,correcto) MsgAlert("Error al Addcionar en el Catálogo de Usuarios") EndIF Else msginfo(modicriterio) IF !oOdbc:Execute(ModiCriterio,"UPDATE",,correcto) MsgAlert("Error al Modificar en el Catálogo de Usuarios") EndIF EndIf ENDIF EndIF oQuery := oOdbc:Query(xcriterio) // lDateAsStr := .t., Formato de Fecha "AAAA/MM/DD" oQuery:lDateAsStr := .f. oQuery:Open() oQuery:Complete() oQuery:GoBottom() IniCUSU(oLbx) lGuarda:= .F. lEsAlta:=.F. lEsModi:=.F. *oLbx:Refresh() Return oQuery //------------------------------------------------------------------ STATIC Function CarCUSU(oLbx) // OK, ODBC oGets[1]:=FieldGet(1)//Clave oGets[2]:=FieldGet(2)//Descripción oGets[3]:=FieldGet(3)//dirección **** oGets[4]:=FieldGet(4)//Número T_Dir:=FieldGet(3)//dirección T_Num:=FieldGet(4)//Número oObjs[1]:Refresh() oObjs[2]:Refresh() oObjs[3]:Refresh() ****oObjs[4]:Refresh() *oLbx:Refresh() Return .T. //------------------------------------------------------------------ STATIC Function IniCUSU(oLbx) lEsAlta:=.T. oGets[1]:=SPACE(2) oGets[2]:=0 oGets[3]:=SPACE(17) ****oGets[4]:=SPACE(30) T_Dir:="" T_Num:="" oObjs[1]:Refresh() oObjs[2]:Refresh() oObjs[3]:Refresh() ****oObjs[4]:Refresh() *oLbx:Refresh() Return .T. //------------------------------------------------------------------ STATIC FUNCTION BusCUSU() RETURN NIL //------------------------------------------------------------------ STATIC FUNCTION ImprimeCUSU(oOdbc) LOCAL oPen1, oPen2 LOCAL oFon1, oFon2, oFon3 LOCAL oReport Local oQueryRep Local RepCriterio:= "SELECT * from Cat_USU Order By mater, juzas" Local aDatos Local nField Local Sihay,i oQueryRep := oOdbc:Query(RepCriterio) // lDateAsStr := .t., Formato de Fecha "AAAA/MM/DD" oQueryRep:lDateAsStr := .f. oQueryRep:Open() oQueryRep:Complete() oQueryRep:Gotop() SiHay:=oQueryRep:RecCount() aDatos := {} For i=1 To SiHay AADD(aDatos,{oQueryRep:FieldGet(1), oQueryRep:FieldGet(2), oQueryRep:FieldGet(3), oQueryRep:FieldGet(4)} ) oQueryRep:Skip() Next *oQueryRep:End() IF len(aDatos) == 0 MsgStop("No Existe Información") oQueryRep:Gotop() RETURN oQueryRep ENDIF DEFINE PEN oPen1 WIDTH 0.7 DEFINE PEN oPen2 WIDTH 0.5 DEFINE FONT oFon1 NAME "Arial" SIZE 0,-11 DEFINE FONT oFon2 NAME "Arial" SIZE 0,-8 DEFINE FONT oFon3 NAME "COURIER NEW" SIZE 0, 10 // Para Imprimir MEMOS nField:=1 REPORT oReport TITLE "Listado de Usuarios"; CAPTION "Catálogo : Usuarios"; HEADER "Tribunal Superior de Justicia del Distrito Federal", ; "Fecha: "+DToC(DATE()),; "Página: "+STR(oReport:nPage,3); FOOTER "- Catálogo de Usuarios -" CENTER; FONT oFon1, oFon2, oFon3 ; PEN oPen1, oPen2; // Tipo de linea a usar en Cabezera PREVIEW COLUMN TITLE "Clave de","Materia" DATA aDatos[nfield,1]+", "+dameMateria(aDatos[nfield,1]) FONT 2 CENTER //Val_Materias(oOdbc,aDatos[nfield,1]) //arreglos.prg COLUMN TITLE "Juzgado" DATA alltrim(str(aDatos[nField,2])) FONT 2 CENTER COLUMN TITLE "Dirección" DATA AllTRIM(aDatos[nField,3]) FONT 2 LEFT COLUMN TITLE "Número" DATA AllTRIM(aDatos[nField,4]) FONT 2 LEFT END REPORT oReport:bSkip := {|| nField++} oReport:CellView() ACTIVATE REPORT oReport WHILE nField <= len(aDatos); ON INIT oReport:oTitle:aFont[1] := { || 3 }; oPen1:End() oPen2:End() oFon1:End() oFon2:End() oFon3:End() oQueryRep:Gotop() RETURN oQueryRep //------------------------------------------------------------------ STATIC FUNCTION BitMaps(oReport) oReport:SayBitmap( 0.6,5, "ArchivoBMP.bmp", 1.9, 1.9, 2 ) RETURN NIL
fw..bitmaps
I saw there is the possibility to save bitmaps on a function as FW_BmpPlus() But How I must make if I wish make the same for my bitmaps ?