topic
stringlengths
1
63
text
stringlengths
1
577k
ADO and empty Dates [SOLVED]
Hello, With ADORDD and Harbour there is a problem with emtpy dates. When issuing an append blank, putting a ctod('') fails. Also, FW_DateToSQL( , "D" ) fails too. As I workarround, I set to date(), but there are some cases I need an emty date(). This is the code: [code=fw:1bhpr914]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />   aStruct := ADOSTRUCT<span style="color: #000000;">&#40;</span> oRs <span style="color: #000000;">&#41;</span><br /><br /><br />   <span style="color: #00C800;">FOR</span> n := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">&#40;</span> aStruct <span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">IF</span> aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">6</span> <span style="color: #000000;">&#93;</span><br /><br />            AADD<span style="color: #000000;">&#40;</span> aCols, aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">1</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><br />            AADD<span style="color: #000000;">&#40;</span> aVals, HB_DECODE<span style="color: #000000;">&#40;</span> aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span>, <span style="color: #ff0000;">'C'</span>, Space<span style="color: #000000;">&#40;</span> aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">'D'</span>, FW_DateToSQL<span style="color: #000000;">&#40;</span> , <span style="color: #ff0000;">"D"</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">'L'</span>, .f., ;<br />                 <span style="color: #ff0000;">'M'</span>, <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">'m'</span>, <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">'+'</span>, <span style="color: #000000;">0</span>, ;<br />                 <span style="color: #ff0000;">'N'</span>, <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> == <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, Val<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"0."</span> + Replicate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">'0'</span>, aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, ;<br />                 <span style="color: #ff0000;">'T'</span>, CTOT<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">''</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">''</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />         <span style="color: #00C800;">ENDIF</span><br />    <span style="color: #00C800;">NEXT</span><br /><br /><br />         oRs:<span style="color: #000000;">AddNew</span><span style="color: #000000;">&#40;</span> aCols, aVals <span style="color: #000000;">&#41;</span><br />     oRs:<span style="color: #0000ff;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><br /> </div>[/code:1bhpr914] Thank you.
ADO and empty Dates [SOLVED]
FW_DateToSQL() and FW_ValToSQL() are meant to be used while constructing SQL statements. FW_DateToSQL( CTOD( "" ) ) returns "NULL" Example usage: if we want to update a datefield: [code=fw:b076l919]<div class="fw" id="{CB}" style="font-family: monospace;"><br />cSql := <span style="color: #ff0000;">"UPDATE MYTABLE SET DOCDT = "</span> + FW_DateToSQL<span style="color: #000000;">&#40;</span> dDate <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">" WHERE ID = 10"</span><br />oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">&#40;</span> cSql <span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:b076l919] Even better cSql := SQL UPDATE MYTABLE SET DOCDT = dDate WHERE ID - 0 For ado, you may use FW_AdoNull() for updating or inserting empty dates
ADO and empty Dates [SOLVED]
Mr. Nages, Thank you very much. This is working: [code=fw:3dhgpjf6]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AADD<span style="color: #000000;">&#40;</span> aVals, HB_DECODE<span style="color: #000000;">&#40;</span> aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">2</span> <span style="color: #000000;">&#93;</span>, <span style="color: #ff0000;">'C'</span>, Space<span style="color: #000000;">&#40;</span> aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">'D'</span>, AdoNull<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">'L'</span>, .f., ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'M'</span>, <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">'m'</span>, <span style="color: #ff0000;">""</span>, <span style="color: #ff0000;">'+'</span>, <span style="color: #000000;">0</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'N'</span>, <span style="color: #00C800;">If</span><span style="color: #000000;">&#40;</span> aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> == <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, Val<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"0."</span> + Replicate<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">'0'</span>, aStruct<span style="color: #000000;">&#91;</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'T'</span>, AdoNull<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">''</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:3dhgpjf6] Best regards,
ADO and resume laptop
Hello, I have a client that use my program on a network. before it was a version with DBF-files. Now I upgrade his program to ADO with MySQL. The program is working very nice, but... The customer don't quit the program at the evening, but all the PC go to 'Sleep-mode'. In the morning he resume the program, but than he get directly an error that the program can't write/access the database. With the DBF-files he didn't get an error, but now he have to restart the program. I know it's better to quit the program, but is there a way to fix this problem without restaring the program?
ADO and resume laptop
Mark If it were me and your customer does not want to shut down his computer, I would go to the control panel and the power settings and on "Close Lid" .. set the option to "Do Nothing" That way, your customer and just shut the lid and walk away and the laptop will not go to sleep. Rick Lipkin
ADO and resume laptop
Hi, I was thinking to do a open again if it fails like[code=fw:2h5ev0f2]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">TRY</span><br />   oSQL:<span style="color: #000000;">execute</span><span style="color: #000000;">&#40;</span> vCommando<span style="color: #000000;">&#41;</span><br />CATCH oErr<br />&nbsp; &nbsp;<span style="color: #00C800;">TRY</span><br />&nbsp; &nbsp; &nbsp; oSQL:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;CATCH oError<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Failed to Connect to the Database "</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; quit<br />&nbsp; &nbsp;END<br />END <span style="color: #00C800;">TRY</span><br /> </div>[/code:2h5ev0f2] I'm wondering that is would be a good solution?
ADO and resume laptop
Hi, I just found out that there is a ADO-state-propery, so I can check that the connection is still OK. I will try to use that.
ADO and resume laptop
[quote="Marc Vanzegbroeck":2kdflhla]Hi, I just found out that there is a ADO-state-propery, so I can check that the connection is still OK. I will try to use that.[/quote:2kdflhla] oCn:State --> 0 = not open and 1 = open But when server disconnects you, your oCn:State shows 1 though in real there is no connection. To resume a connection you need to do: [code=fw:2kdflhla]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">TRY</span><br />&nbsp; &nbsp;oCon:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />CATCH<br />&nbsp; &nbsp;<span style="color: #B900B9;">// handle failure and exit</span><br />END<br /><span style="color: #00C800;">if</span> oCn:<span style="color: #000000;">State</span> == <span style="color: #000000;">0</span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// not connected</span><br /><span style="color: #00C800;">else</span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// connected .. go ahead</span><br /><span style="color: #00C800;">endif</span><br />&nbsp;</div>[/code:2kdflhla] When connection dies (due to loss of connectivity or server closing the connection), only way we know it when we get a runtime error. Any openration, even a recordset movement causes runtime eror. So try to have a global error block directing to your own error routine: 1. Check if it is Ado Error ( check oCn:Errors collection ) 2. If Ado error is it related to connection a. If not call standard error routne b. If yes, Try Resume connection as above and then return RETRY operation
ADO and resume laptop
Thank you Rao, Indeed, I just found out that oCn:State is still open, even when I disconnected the network. I try to use your suggestion, and put it in my global error-handler. The only problem I have ir the network-connections was lost, and back OK-again (after resuming the PC) is when writing to the database, because, for reading I allways use a recordset that I open while reading it. If the connections is back OK, than it works. But for opdating, writing to the database, I use a connection that I open in the beginning of my program, and close while exiting the program.
ADO and resume laptop
We are not opening a new connection again. We are closing and reopening the same connection that you opened first. Still do you get error while writing? Meanwhile please also see <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=26907&start=0&hilit=recordset+local">viewtopic.php?f=3&t=26907&start=0&hilit=recordset+local</a><!-- l -->
ADO and resume laptop
I know than whe are using the same connection again, but I was refering to recordset that are allways are reopen while calling. But anyhow, it's working now, like you suggested. By closing the connection, and reopening it, if there was an error. Thanks,
ADO and resume laptop
Glad it is working. Can you post your Code here for the benefit of all of us? Can we standardise this and integrate with fwh adofuncs library?
ADO and resume laptop
For now I have put in my functions I have made for myself for updating, deleting and adding records with ADO, because I needed it very fast for that customer. I will put it in my error-handler, so it will work allways when there is an ADO-error. It will than also write the error in the error-file. Now the customer just get an error that the connections was lost, and that the program can't reconnect anymore... I will post the code after I put it in my error handler.
ADO and resume laptop
Rao, What I was thinking to do is add this to errorsys.prg [code=fw:30bbqes2]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">if</span> ErrorMessage<span style="color: #000000;">&#40;</span> e <span style="color: #000000;">&#41;</span> = <span style="color: #ff0000;">'Error ADODB.Connection/16389 &nbsp;E_FAIL: EXECUTE'</span><br />&nbsp; &nbsp;oSQL:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oSQL:=CreateObject<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADODB.Connection"</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">TRY</span><br />&nbsp; &nbsp; &nbsp; oSQL:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">return</span> .f.<br />&nbsp; &nbsp;CATCH<br />&nbsp; &nbsp; &nbsp; Msgalert<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Error connecting to server"</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;END <span style="color: #00C800;">TRY</span><br /><span style="color: #00C800;">endif</span><br />&nbsp;</div>[/code:30bbqes2]
ADO and resume laptop
Hi, After debugging the program, I finaly found the error that my customer get. It is : 'MySQL server has gone away' Now I'm looking a for a way to reconnect. I found something like oSql:ping(), fut there is also a possibility to auto-reconnect according to the MySQL-site. Has anyone already did something like this?
ADO append con Uniqueidentifier en MSSQL
Manualmente hago asi para agregar un registro con el campo ID del tipo uniqueidentifier: (B85E62C3-DC56-40C0-852A-49F759AC68FB) [code:5i9csd9t] INSERT INTO articoli &#40;ID, Sub_ID, codice, descrizione&#41; VALUES &#40;NEWID&#40;&#41;, 15, 'uno', 'due'&#41; [/code:5i9csd9t] Alguien sabe como hacerlo con ADO? [code:5i9csd9t] FOR i &#58;= 1 TO 5000 oRs&#58;AddNew&#40;&#41; //oRs&#58;fields&#40;"ID"&#41;&#58;VALUE &#58;= "NEWID&#40;&#41;" oRs&#58;fields&#40;"Sub_ID"&#41;&#58;VALUE &#58;= i oRs&#58;fields&#40;"codice"&#41;&#58;value &#58;= "COD" + ALLTRIM&#40; STR&#40; i &#41; &#41; oRs&#58;Fields&#40; "descrizione" &#41;&#58;Value &#58;= "Descrizione articolo " + ALLTRIM&#40; STR&#40; i &#41; &#41; oRs&#58;Update&#40;&#41; NEXT [/code:5i9csd9t] Gracias
ADO append con Uniqueidentifier en MSSQL
Fernando, no puedo usar adordd porque no compila con la version de xharbour que uso yo, que no puedo cambiar porque uso FWH 2.7 que actualizaré apenas me lo permitan. De todos modos, no se si está previsto, pero cuando el campo es del tipo uniqueidentifier hay que llamar a una funcion NewID() para crear el uniqueidentifier, que manualmente se hace "INSERT INTO articoli (ID, codice) VALUES (NewID(), 'codigo uno')" Mi problema es que con ADO no podia hacerlo en automatico, de todos modos lo he resuelto en este modo: [code:1bqlnruj] TRY oRs&#58;AddNew&#40;&#41; CATCH oError MsgStop&#40;oError&#58;Operation+CRLF+oError&#58;Description,"Ado Connection"&#41; RETURN NIL END TRY TRY oRs2 &#58;= oConnection&#58;Execute&#40;"select newid&#40;&#41;"&#41; CATCH oError MsgStop&#40;oError&#58;Operation+CRLF+oError&#58;Description,"Ado Connection"&#41; RETURN NIL END TRY cNewID &#58;= oRs2&#58;fields&#40;0&#41;&#58;value oRs&#58;fields&#40;"ID"&#41;&#58;VALUE &#58;= cNewID oRs&#58;fields&#40;"Sub_ID"&#41;&#58;VALUE &#58;= i oRs&#58;fields&#40;"codice"&#41;&#58;value &#58;= "COD" + ALLTRIM&#40; STR&#40; i &#41; &#41; oRs&#58;Fields&#40; "descrizione" &#41;&#58;Value &#58;= "Descrizione articolo " + ALLTRIM&#40; STR&#40; i &#41; &#41; oRs&#58;Fields&#40; "nota1" &#41;&#58;Value &#58;= REPLICATE&#40;"-=-", 800 &#41; oRs&#58;Fields&#40; "nota2" &#41;&#58;Value &#58;= REPLICATE&#40;"-+-", 800 &#41; oRs&#58;Fields&#40; "messaggio" &#41;&#58;Value &#58;= REPLICATE&#40;"&#46;-&#46;", 800 &#41; TRY oRs2&#58;close&#40;&#41; CATCH END TRY [/code:1bqlnruj] Seria bueno preveerlo que en ADORDD (si ya no lo hace) que cuando el campo sea de este tipo, lo genere automaticamente al hacer un append. Saludos y gracias de tu tiempo.
ADO append con Uniqueidentifier en MSSQL
Con ado puedes utilizar el metodo Execute del objeto connection. [code:1vn1im4w] oCnn&#58;Execute&#40;"INSERT INTO articoli &#40;ID, Sub_ID, codice, descrizione&#41; VALUES &#40;NEWID&#40;&#41;, 15, 'uno', 'due'&#41; "&#41; [/code:1vn1im4w]
ADO append con Uniqueidentifier en MSSQL
Biel, justamente, como habia leido aqui que RF decía que conviene usar oRs:update() en vez del comando INSERT (o de repente yo lo entendí mal), es que quería saber como hacerlo con el recordset (:update() en vez que con :Execute() gracias de tu tiempo.
ADO append con Uniqueidentifier en MSSQL
[quote="Fernando Mancera":1ypgk66h]Hola Pedro, En el mensaje referente a ADORDD un usuario posteo un link con todo lo necesario para hacer funcionar en xHarbour. Recuerda compilar el codigo fuente de ADORDD con tu version de xHarbour. [url:1ypgk66h]http&#58;//rapidshare&#46;com/files/29234022/adoRDD&#46;rar&#46;html[/url:1ypgk66h][/quote:1ypgk66h] Fer, compila tanto en xharbour como harbour. por cierto, sería conveniente incluir las modificaciones en el cvs de harbour. saludos
ADO append con Uniqueidentifier en MSSQL
William, Vamos a subir las modificaciones al CVS de Harbour, lo que ocurre es que queremos hacer algunos cambios en el código para eliminar diferencias entre Harbour y xHarbour y que a ser posible, se use el mismo código con ambos
ADO append con Uniqueidentifier en MSSQL
[quote="Antonio Linares":81rk2v0q]William, Vamos a subir las modificaciones al CVS de Harbour, lo que ocurre es que queremos hacer algunos cambios en el código para eliminar diferencias entre Harbour y xHarbour y que a ser posible, se use el mismo código con ambos[/quote:81rk2v0q] ok. gracias
ADO back up full database
Hi, Using ado/FW_ado functions as DBMS management irrespective of MYSQL, MSSQL, etc, is there a way to back up the whole database to a local file? Thank you
ADO back up full database
Backup and Restore are specific to each database. There is no common support in ADO. For MySql, we can use FWH oCon:Backup(...) and oCon:Restore(...) methods.
ADO back up full database
Thank you. And what about saving and restoring each table in a txt local file? All the best,
ADO back up full database
Up!
ADO back up full database
Moises: Take a look at MySqlDump.exe and MySQL.Exe Regards
ADO back up full database
Thank you very much for replying. I am looking for an approach via ADO for MySQL/MSSQL/María DB, therefore neutral from the point of view of the database. I think this method exists, but I haven't found its parameters. Greetings
ADO back up full database
Up!
ADO com DBF (Acentuação)
Fala pessoal! Estou fazendo um select em uma tabela DBF via ADO, e a acentuação no RecordSet esta incorreta. Alguém já passou por isto? [code=fw:1kopckza]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">Function</span> U_Teste<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> oConn<br /><span style="color: #00C800;">Local</span> cSQL<br /><span style="color: #00C800;">Local</span> rsClaims<br /><br />oConn:= CreateObject<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADODB.Connection"</span><span style="color: #000000;">&#41;</span><br />oConn:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:<span style="color: #000000;">\t</span>emp<span style="color: #000000;">\d</span>ados;Extended Properties=DBASE IV"</span><span style="color: #000000;">&#41;</span><br /><br />cSQL := <span style="color: #ff0000;">"SELECT * FROM SP50001"</span><br /><br />rsClaims := CreateObject<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADODB.Recordset"</span><span style="color: #000000;">&#41;</span><br />rsClaims:<span style="color: #000000;">CursorLocation</span> := <span style="color: #000000;">3</span>  <span style="color: #B900B9;">// adUseClient</span><br />rsClaims:<span style="color: #000000;">CursorType</span> := <span style="color: #000000;">3</span> <span style="color: #B900B9;">// adOpenStatic</span><br />rsClaims:<span style="color: #000000;">ActiveConnection</span>:= oConn<br />rsClaims:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span>cSQL<span style="color: #000000;">&#41;</span><br /><br />rsClaims:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />MsgStop<span style="color: #000000;">&#40;</span>rsClaims:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"SP5_CODIGO"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">&#41;</span> &nbsp; &nbsp;<span style="color: #B900B9;">//ONDE DEVERIA SER 'MIRIÃ' É RETORNADO 'MIRI+'</span><br /><br /><span style="color: #00C800;">Return</span></div>[/code:1kopckza]
ADO com DBF (Acentuação)
Achei! É só alterar a chave do registro do windows: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\xBase, DataCodePage=OEM para DataCodePage=ANSI Valeu
ADO com DBF (Recno)
Estou acessando a tabela DBF via ADO e gostaria de obter o Recno físico da tabela. Vi que o RecordSet do ADO possui tanto a BookMark como a AbsolutiPosition, mas ambas retornam a posição de um registro referente ao RecordSet em vez de obter o posição do registro da tabela física. Alguem sabe como obter?
ADO com Excel
Ola amigos, Preciso ler planilha Excel com ADO, é possivel ? gostaria de um exemplo Ari
ADO com Excel
No necesitas ADO, con OLE es mas que suficiente: [code:10ufe4or] oExcel &#58;= TOleAuto&#40;&#41;&#58;New&#40; "Excel&#46;Application" &#41; oExcel&#58;WorkBooks&#58;Open&#40;"yourfile&#46;xls"&#41; oHoja &#58;= oExcel&#58;Get&#40; "ActiveSheet" &#41; nRows &#58;= oHoja&#58;UsedRange&#58;Rows&#58;Count&#40;&#41; nCols &#58;= oHoja&#58;UsedRange&#58;Columns&#58;Count&#40;&#41; USE filedbf FOR nRow &#58;= 2 TO nRows APPEND BLANK For nfrom &#58;= 1 TO nCols FIELDPUT&#40;nFrom, oHoja&#58;Cells&#40;nRow,nCol&#41;&#58;Value&#41; NEXT NEXT [/code:10ufe4or]
ADO com Excel
o usuário não tem o Excel. Eu já uso desta forma que voce falou Rene, para algumas planilhas com mais de 10.000 linhas, o sistema vai parando ..ficando lento por falta de memoria.. com ODBC eu fiz assim: [code:2frtg540]Function Teste&#40;oMeter&#41; // Ler arquivos Excel com ODBC local oDbc &#58;= TOdbc&#40;&#41;&#58;New&#40;&#41; // criar o ODBC no Windows ! local n &#58;= 1 local oAdo &#58;= TdbOdbc&#40;&#41;&#58;New&#40;"SELECT * FROM &#91;folha1$&#93;", oDbc&#41; oMeter&#58;nTotal &#58;= oAdo&#58;RecCount&#40;&#41; While !oAdo&#58;eof&#40;&#41; ++n oMeter&#58;cText &#58;= padr&#40;oAdo&#58;FieldGet&#40;1&#41;,18&#41; + " " + padr&#40; oAdo&#58;FieldGet&#40;2&#41; ,20&#41; oMeter&#58;Set&#40;n&#41; oMeter&#58;refresh&#40;&#41; oAdo&#58;skip&#40;&#41; End return nil[/code:2frtg540] * isto funcionou, mas eu tenho que criar a conexao na maquina do usuario para funcionar, gostaria de algo direto. Ari
ADO com Excel
Amiguinho Complementando o exemplo do Amigo Rene, neste exemplo voce poderá [b:1n11mxjm]ler e gravar[/b:1n11mxjm] dados em planilhas simples. [code:1n11mxjm] * * ---------------------------------------------------------------- * FUNCTION OLEExcel&#40;&#41; LOCAL oWnd, oMenu MENU oMenu MENUITEM "&Probar Excel y DBF" MENU MENUITEM "&Leer SIGLAS&#46;XLS" ACTION LEER&#40;&#41; MENUITEM "&Enviar SIGLAS&#46;DBF a Excel" ACTION ENVIAR&#40;&#41; WHEN FILE&#40; "SIGLAS&#46;DBF" &#41; SEPARATOR MENUITEM "&Salir" ACTION oWnd&#58;End&#40;&#41; ENDMENU ENDMENU DEFINE WINDOW oWnd FROM 0,0 TO 20,70 MENU oMenu TITLE "Probar Excel y DBF" ACTIVATE WINDOW oWnd MAXIMIZED RETURN FUNCTION LEER&#40;&#41; LOCAL oExcel, oHoja, nRows, nCols LOCAL aCampos&#58;=&#123;&#125;, nRow, nCol oExcel &#58;= TOleAuto&#40;&#41;&#58;New&#40; "Excel&#46;Application" &#41; oExcel&#58;WorkBooks&#58;Open&#40;SFN2LFN&#40;cFilePath&#40;GetModuleFileName&#40;GetInstance&#40;&#41;&#41;&#41;+"SIGLAS&#46;xls"&#41;&#41; oHoja &#58;= oExcel&#58;Get&#40; "ActiveSheet" &#41; nRows &#58;= oHoja&#58;UsedRange&#58;Rows&#58;Count&#40;&#41; nCols &#58;= oHoja&#58;UsedRange&#58;Columns&#58;Count&#40;&#41; FOR nCol &#58;= 1 TO nCols IF ValType&#40; oHoja&#58;Cells&#40; 2, nCol &#41;&#58;Value &#41; = "C" AADD&#40; aCampos, &#123; oHoja&#58;Cells&#40; 1, nCol &#41;&#58;Value, "C", 80, 0 &#125; &#41; ELSEIF ValType&#40; oHoja&#58;Cells&#40; 2, nCol &#41;&#58;Value &#41; = "N" AADD&#40; aCampos, &#123; oHoja&#58;Cells&#40; 1, nCol &#41;&#58;Value, "N", 15, 4 &#125; &#41; ELSEIF ValType&#40; oHoja&#58;Cells&#40; 2, nCol &#41;&#58;Value &#41; = "L" AADD&#40; aCampos, &#123; oHoja&#58;Cells&#40; 1, nCol &#41;&#58;Value, "L", 1, 0 &#125; &#41; ELSEIF ValType&#40; oHoja&#58;Cells&#40; 2, nCol &#41;&#58;Value &#41; = "D" AADD&#40; aCampos, &#123; oHoja&#58;Cells&#40; 1, nCol &#41;&#58;Value, "D", 8, 0 &#125; &#41; ENDIF NEXT DBCREATE&#40; "EXCEL", aCampos &#41; USE "EXCEL" NEW FOR nRow &#58;= 2 TO nRows APPEND BLANK FOR nCol &#58;= 1 TO nCols FIELDPUT&#40; nCol, oHoja&#58;Cells&#40; nRow, nCol &#41;&#58;Value &#41; NEXT NEXT CLOSE DATABASES oExcel&#58;Quit&#40;&#41; oHoja&#58;End&#40;&#41; oExcel&#58;End&#40;&#41; MsgInfo&#40; "Foi criado o arquivo EXCEL&#46;DBF" &#41; RETURN FUNCTION ENVIAR&#40;&#41; LOCAL oExcel, oHoja LOCAL nRow &#58;= 1, nCol oExcel &#58;= TOleAuto&#40;&#41;&#58;New&#40; "Excel&#46;Application" &#41; oExcel&#58;WorkBooks&#58;Add&#40;&#41; oHoja &#58;= oExcel&#58;Get&#40; "ActiveSheet" &#41; USE "SIGLAS" NEW FOR nCol &#58;= 1 TO FCOUNT&#40;&#41; oHoja&#58;Cells&#40; nRow, nCol &#41;&#58;Value &#58;= FieldName&#40; nCol &#41; NEXT DO WHILE &#46;NOT&#46; EOF&#40;&#41; nRow++ FOR nCol &#58;= 1 TO FCOUNT&#40;&#41; oHoja&#58;Cells&#40; nRow, nCol &#41;&#58;Value &#58;= FieldGet&#40; nCol &#41; NEXT SKIP ENDDO FOR nCol &#58;= 1 TO FCOUNT&#40;&#41; oHoja&#58;Columns&#40; nCol &#41;&#58;AutoFit&#40;&#41; NEXT CLOSE DATABASES oExcel&#58;Visible &#58;= &#46;T&#46; oHoja&#58;End&#40;&#41; oExcel&#58;End&#40;&#41; RETURN [/code:1n11mxjm]
ADO com FireBird
Procuro as classes do FireBird, para usar com ADO, hoje uso o MySQL, gostaria de tentar o FireBird. Ari
ADO com FireBird
Ari: Contact to Rochinha, I remenber her made to library for Firebird + ADO. <!-- e --><a href="mailto:irochinha@itelefonica.com.br">irochinha@itelefonica.com.br</a><!-- e -->; Regards , Juan
ADO con MS SQL 2005
Hola, Una pregunta breve y concreta, como funciona MS SQL Server 2005 con ADO, usando el provider native correpsondiente? O recomiendan usar MS SQL Server 2000? Saludos, Mario A. Dávalos
ADO con MySQL problema con listbox
Mi problema es que al cargar el recordset, el listbox no muestra nada y el RecordCount muestra -1 <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> gracias de antemano por cualquier ayuda <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> saludos y xhabrazos [code=fw:1b13gfgd]<div class="fw" id="{CB}" style="font-family: monospace;">oCon := TOLEAUTO<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.connection"</span><span style="color: #000000;">&#41;</span><br />oCon:<span style="color: #000000;">ConnectionString</span>:=<span style="color: #ff0000;">"Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=ERP;User='root'; Password='root';Option=3;"</span><br /><span style="color: #00C800;">TRY</span><br />  oCon:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />  <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"CONECTADO"</span><span style="color: #000000;">&#41;</span><br />CATCH<br />    MSGSTOP<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"NO SE CONECTO"</span><span style="color: #000000;">&#41;</span><br />END<br />oCmd := TOLEAUTO<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.command"</span><span style="color: #000000;">&#41;</span><br />oCmd :<span style="color: #000000;">ActiveConnection</span><span style="color: #000000;">&#40;</span>oCon<span style="color: #000000;">&#41;</span><br />oCmd :<span style="color: #000000;">CommandText</span> := <span style="color: #ff0000;">"SELECT * FROM articulos ORDER BY descripcion"</span><br /><br />oRs := TOleAuto<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.recordset"</span><span style="color: #000000;">&#41;</span><br />oRS :<span style="color: #000000;">CursorLocation</span> := adUseClient<br />oRS :<span style="color: #000000;">LockType</span>   := adLockOptimistic<br />oRS :<span style="color: #000000;">CursorType</span> := adOpenKeyset<br />oRs := oCmd:<span style="color: #000000;">Execute</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> ODLG <span style="color: #0000ff;">resource</span> <span style="color: #ff0000;">"ODLG_MANART"</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"  TABLA DE ARTICULOS "</span><br /><br /> oRs:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />? oRs:<span style="color: #000000;">RecordCount</span>  <span style="color: #B900B9;">//  me muestra -1</span><br />? oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"codigo"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span>+<span style="color: #ff0000;">" "</span>+ oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"descripcion"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span> <span style="color: #B900B9;">// me muestra bien los datos del primer registro</span><br /><span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">LISTBOX</span> oLbx FIELDS oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"codigo"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span>,;<br />                                                      oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"descripcion"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span>;<br />                                             HEADERS <span style="color: #ff0000;">"Código"</span>,;<br />                                                      <span style="color: #ff0000;">"Descripcion"</span>;<br />                                            <span style="color: #0000ff;">id</span> <span style="color: #000000;">135</span> <span style="color: #0000ff;">of</span> Odlg                                                                                          <br />oLbx:<span style="color: #000000;">aJustify</span> := <span style="color: #000000;">&#123;</span>.F.,.f.,.t.,.t.<span style="color: #000000;">&#125;</span><br /> </div>[/code:1b13gfgd]
ADO con MySQL problema con listbox
Luis Here is an example of some MS Sql code using ADO with a redefine listbox .. Look at the codeblocks and the Skipper function .. Rick Lipkin [code=fw:t6bjmplf]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />... open tables<br /><br /><span style="color: #00C800;">IF</span> oRs1:<span style="color: #000000;">eof</span><br />   oRs1:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">ENDIF</span><br /><br />oRs1:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"DISTSLCT"</span>                           ;<br />       <span style="color: #0000ff;">COLOR</span> <span style="color: #ff0000;">"W+/W"</span>                                              ;<br />       <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"DISTRICT Select"</span>                                   ;<br /><br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">LISTBOX</span> oLBX FIELDS          ;<br />       oRs1:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"DISTRICT"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>     ;<br />     SIZES <span style="color: #000000;">150</span>                           ;<br />     HEADERS <span style="color: #ff0000;">"District"</span>                  ;<br />     <span style="color: #0000ff;">ID</span> <span style="color: #000000;">111</span> <span style="color: #0000ff;">of</span> oDlg<br /><br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBTN1 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">113</span>              ;<br />       <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> zDISTRICT := oRs1:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"district"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>,;<br />                oOBJ:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,              ;<br />                oDlg:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>                 ;<br />       <span style="color: #00C800;">DEFAULT</span><br /><br /><br />   <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBTN2 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">112</span>             ;<br />       <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span> oDLG:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br />    oLbx:<span style="color: #000000;">bLogicLen</span> := <span style="color: #000000;">&#123;</span> || oRs1:<span style="color: #000000;">RecordCount</span> <span style="color: #000000;">&#125;</span><br />    oLbx:<span style="color: #000000;">bGoTop</span>    := <span style="color: #000000;">&#123;</span> || oRs1:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />    oLbx:<span style="color: #000000;">bGoBottom</span> := <span style="color: #000000;">&#123;</span> || oRs1:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />    oLbx:<span style="color: #000000;">bSkip</span>     := <span style="color: #000000;">&#123;</span> | nSkip | Skipper<span style="color: #000000;">&#40;</span> oRs1, nSkip <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />    oLbx:<span style="color: #000000;">cAlias</span>    := <span style="color: #ff0000;">"ARRAY"</span><br /><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><br />oRs1:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />oDLG  := <span style="color: #00C800;">NIL</span><br />oLBX  := <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span> .T. <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #B900B9;">//-------------------------------</span><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SKIPPER<span style="color: #000000;">&#40;</span> oRsx, nSkip <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">LOCAL</span> nRec := oRsx:<span style="color: #000000;">AbsolutePosition</span><br /><br />oRsx:<span style="color: #0000ff;">Move</span><span style="color: #000000;">&#40;</span> nSkip <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">IF</span> oRsx:<span style="color: #000000;">EOF</span>; oRsx:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">IF</span> oRsx:<span style="color: #000000;">BOF</span>; oRsx:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #00C800;">ENDIF</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span> oRsx:<span style="color: #000000;">AbsolutePosition</span> - nRec <span style="color: #000000;">&#41;</span><br /> </div>[/code:t6bjmplf]
ADO con MySQL problema con listbox
Thanks for your help Rick, I did it as you said in your example but it did't work, besides the function oRs:MoveLast() is not working, the program display the folowing error when it is executed. Application =========== Path and name: c:\sistemas\sofvenxh\sofvenxh.Exe (32 bits) Size: 3,429,888 bytes Time from start: 0 hours 0 mins 10 secs Error occurred at: 16/08/2011, 13:26:53 Error description: Error adodb.command:EXECUTE/6 DISP_E_UNKNOWNNAME: MOVELAST Args: Regards [code=fw:2vwl3ze0]<div class="fw" id="{CB}" style="font-family: monospace;">     oCmd := TOLEAUTO<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.command"</span><span style="color: #000000;">&#41;</span><br />     oCmd :<span style="color: #000000;">ActiveConnection</span><span style="color: #000000;">&#40;</span>oCon<span style="color: #000000;">&#41;</span><br />   oCmd :<span style="color: #000000;">CommandText</span> := <span style="color: #ff0000;">"SELECT * FROM articulos "</span>                     <span style="color: #B900B9;">//ORDER BY descripcion</span><br /><br />     oRS := TOleAuto<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.recordset"</span><span style="color: #000000;">&#41;</span><br />     oRS :<span style="color: #000000;">CursorLocation</span> := adUseClient          <span style="color: #B900B9;">//  EL RECORSET ESTA AL LADO DEL CLIENTE Y NO EN EN EL SERVER</span><br />     oRS :<span style="color: #000000;">LockType</span>   := adLockOptimistic<br />     <span style="color: #B900B9;">//oRS :CursorType := adOpenKeyset</span><br />   oRS := oCmd:<span style="color: #000000;">Execute</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// here the error appears</span><br /><br />     oRs:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /> </div>[/code:2vwl3ze0]
ADO con MySQL problema con listbox
problema solucionado !! [code=fw:3gfrqwj1]<div class="fw" id="{CB}" style="font-family: monospace;">   oCon := TOLEAUTO<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.connection"</span><span style="color: #000000;">&#41;</span><br />   oCon:<span style="color: #000000;">ConnectionString</span>:=<span style="color: #ff0000;">"Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=ERP;User='root'; Password='root';Option=3;"</span><br />     <span style="color: #00C800;">TRY</span><br />       oCon:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />     <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"CONECTADO"</span><span style="color: #000000;">&#41;</span><br />     CATCH<br />        MSGSTOP<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"NO SE CONECTO"</span><span style="color: #000000;">&#41;</span><br />     END<br />     oCmd := TOLEAUTO<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.command"</span><span style="color: #000000;">&#41;</span><br />     oCmd :<span style="color: #000000;">ActiveConnection</span><span style="color: #000000;">&#40;</span>oCon<span style="color: #000000;">&#41;</span><br />   <span style="color: #B900B9;">//oCmd :CommandText := "SELECT * FROM articulos ORDER BY descripcion"     esto no funcionaba y oRS := oCmd:Execute()</span><br />     oRS := TOleAuto<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.recordset"</span><span style="color: #000000;">&#41;</span>                                 <span style="color: #B900B9;">//comentado mas abajo</span><br />     oRS :<span style="color: #000000;">CursorLocation</span> := adUseClient<br />     oRS :<span style="color: #000000;">LockType</span>   := adLockOptimistic<br />     oRS :<span style="color: #000000;">CursorType</span> := adOpenKeyset<br />   <span style="color: #B900B9;">//oRS := oCmd:Execute()</span><br />   oRs:<span style="color: #000000;">activeconnection</span><span style="color: #000000;">&#40;</span>oCon<span style="color: #000000;">&#41;</span>                                   <span style="color: #B900B9;">// con estas 3 lineas</span><br />     oRs:<span style="color: #000000;">source</span> := <span style="color: #ff0000;">"SELECT * FROM articulos ORDER BY descripcion"</span> <span style="color: #B900B9;">// funcionó</span><br />     oRS:<span style="color: #000000;">open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>                                                   <span style="color: #B900B9;">// perfecto</span><br /> </div>[/code:3gfrqwj1]
ADO con MySQL problema con recordset
Estoy comenzando a trabajar con ADO y MySql hasta aquí hice un pequeño mantenedor de una tabla de artículos en la que puedo agregar, eliminar y crear registros desde el recordset y funciona bien, pero luego despues de unos minutos de operar (modificabdo y creando) aparece el error mas abajo, lo he probado como localhost y conectandome a una DB remota. Será porque se desconecta del servidor?, porque despues al volver a entrar funciona por un tiempo y se cae nuevamente. Path and name: c:\sistemas\sofvenxh\sofvenxh.Exe (32 bits) Size: 3,432,960 bytes Time from start: 0 hours 4 mins 42 secs Error occurred at: 27/08/2011, 20:16:35 Error description: Error adodb.recordset/6 DISP_E_UNKNOWNNAME: MOVE Args: [ 1] = N -11 Stack Calls =========== Called from: source\rtl\win32ole.prg => TOLEAUTO:MOVE(0) Called from: c:\sistemas\sofvenxh\manarti.prg => SKIPPER(119) Called from: c:\sistemas\sofvenxh\manarti.prg => (b)MANARTI(85) Called from: .\source\classes\WBROWSE.PRG => TWBROWSE:SKIP(1733) Called from: .\source\classes\WBROWSE.PRG => TWBROWSE:PAINT(757) Called from: .\source\classes\WBROWSE.PRG => TWBROWSE:DISPLAY(2277) Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1630) Called from: .\source\classes\WBROWSE.PRG => TWBROWSE:HANDLEEVENT(1656) Aquí el código del prg GRACIAS DE ANTEMANO POR CUALQUIER AYUDA [code=fw:4t2rc46d]<div class="fw" id="{CB}" style="font-family: monospace;">     oCon := TOLEAUTO<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.connection"</span><span style="color: #000000;">&#41;</span><br />   oCon:<span style="color: #000000;">ConnectionString</span>:=<span style="color: #ff0000;">"Driver={MySQL ODBC 3.51 Driver};Server="</span>+cHost+<span style="color: #ff0000;">";Port=3306;Database="</span>+cDataBase+<span style="color: #ff0000;">";User="</span>+cUser+<span style="color: #ff0000;">"; Password="</span>+cPassWord+<span style="color: #ff0000;">";Option=3;"</span><br />     oCon:<span style="color: #000000;">ConnectionTimeout</span>:=<span style="color: #000000;">3600</span><br />   <span style="color: #B900B9;">//oCon:ConnectionString:="Driver={MySQL ODBC 3.51 Driver};Server="+cHost+";Port=3306;Database=portalphpnuke;User=user; Password=password;Option=3;"</span><br /><br />     <span style="color: #00C800;">TRY</span><br />       oCon:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />     CATCH<br />        MSGSTOP<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"NO SE CONECTO"</span><span style="color: #000000;">&#41;</span><br />            <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br />     END<br />     oCmd := TOLEAUTO<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.command"</span><span style="color: #000000;">&#41;</span><br />     oCmd :<span style="color: #000000;">ActiveConnection</span><span style="color: #000000;">&#40;</span>oCon<span style="color: #000000;">&#41;</span><br />     oRS := TOleAuto<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"adodb.recordset"</span><span style="color: #000000;">&#41;</span><br />     oRS :<span style="color: #000000;">CursorLocation</span> := adUseClient<br />     oRS :<span style="color: #000000;">LockType</span>       := adLockOptimistic<br />     oRS :<span style="color: #000000;">CursorType</span>     := adOpenKeyset<br />   oRs:<span style="color: #000000;">ActiveConnection</span><span style="color: #000000;">&#40;</span>oCon<span style="color: #000000;">&#41;</span><br />     oRs:<span style="color: #000000;">Source</span> := <span style="color: #ff0000;">"SELECT * FROM articulos ORDER BY descripcion"</span><br />     oRS:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #B900B9;">/*IF oRS:Supports(adSeek)   // Aqui Indexamos el RecordSet Para poder buscar, en este caso por codigo<br />      oRS:Index := "codigo"<br />            msginfo("index")<br />   ENDIF*/</span><br /><br />     <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> ODLG <span style="color: #0000ff;">resource</span> <span style="color: #ff0000;">"ODLG_MANART"</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"TABLA DE ARTICULOS"</span><br /><br />     <span style="color: #0000ff;">REDEFINE</span> METER oMeter <span style="color: #0000ff;">VAR</span> nParte TOTAL nTotal <span style="color: #0000ff;">ID</span> <span style="color: #000000;">300</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span> <span style="color: #B900B9;">// BARCOLOR RGB(0,0,128),RGB(0,0,128)</span><br /><br />     <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> oG340 <span style="color: #0000ff;">VAR</span> cBuscar <span style="color: #0000ff;">ID</span> <span style="color: #000000;">340</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">UPDATE</span> <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@!"</span> ;<br />     <span style="color: #0000ff;">VALID</span> <span style="color: #000000;">&#40;</span>FILTRA_MAR<span style="color: #000000;">&#40;</span>cBuscar,oRS,oLBx<span style="color: #000000;">&#41;</span>,.T.<span style="color: #000000;">&#41;</span><br /><br />     oRS:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />     <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">LISTBOX</span> oLbx FIELDS oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"codigo"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span>,;<br />                                                               oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"descripcion"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span>,;<br />                                                               oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Precioventa"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span>;<br />        SIZES <span style="color: #000000;">40</span>,<span style="color: #000000;">250</span>,<span style="color: #000000;">20</span>;<br />                                                 HEADERS <span style="color: #ff0000;">"Código"</span>,;<br />                                                                 <span style="color: #ff0000;">"Descripcion"</span>,;<br />                                                                 <span style="color: #ff0000;">"Precio"</span>;<br />                                                <span style="color: #0000ff;">id</span> <span style="color: #000000;">135</span> <span style="color: #0000ff;">of</span> Odlg  <span style="color: #0000ff;">UPDATE</span> <span style="color: #0000ff;">ON</span> DBLCLICK<span style="color: #000000;">&#40;</span>EDITA_MAR<span style="color: #000000;">&#40;</span>.f.,oRS<span style="color: #000000;">&#41;</span>,oLbx:<span style="color: #0000ff;">REFRESH</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />   oLbx:<span style="color: #000000;">aJustify</span> := <span style="color: #000000;">&#123;</span>.F.,.f.,.t.,.t.<span style="color: #000000;">&#125;</span><br />     oLbx:<span style="color: #000000;">bLogicLen</span> := <span style="color: #000000;">&#123;</span> || oRs:<span style="color: #000000;">RecordCount</span> <span style="color: #000000;">&#125;</span><br />   oLbx:<span style="color: #000000;">bGoTop</span>    := <span style="color: #000000;">&#123;</span> || oRs:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />   oLbx:<span style="color: #000000;">bGoBottom</span> := <span style="color: #000000;">&#123;</span> || oRs:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />   oLbx:<span style="color: #000000;">bSkip</span>     := <span style="color: #000000;">&#123;</span> | nSkip | Skipper<span style="color: #000000;">&#40;</span> oRs, nSkip <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />   oLbx:<span style="color: #000000;">cAlias</span>    := <span style="color: #ff0000;">"ARRAY"</span><br /><br />    oLbx:<span style="color: #000000;">bKeyDown</span> :=<span style="color: #000000;">&#123;</span>|nKey|IIF<span style="color: #000000;">&#40;</span>nKey == VK_RETURN,<span style="color: #000000;">&#40;</span>EDITA_MAR<span style="color: #000000;">&#40;</span>.F.,oRS<span style="color: #000000;">&#41;</span>,oLbx:<span style="color: #000000;">bGOTOP</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,olbx:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,OLBX:<span style="color: #000000;">SETFOCUS</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>,;<br />  IIF<span style="color: #000000;">&#40;</span>nKey == VK_DELETE ,ELIM_MAR<span style="color: #000000;">&#40;</span>oRS,oLBx<span style="color: #000000;">&#41;</span>,;<br />    IIF<span style="color: #000000;">&#40;</span>nKey == VK_INSERT ,<span style="color: #000000;">&#40;</span>EDITA_MAR<span style="color: #000000;">&#40;</span>.T.,oRS<span style="color: #000000;">&#41;</span>,oLbx:<span style="color: #000000;">bGOTOP</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,olbx:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,OLBX:<span style="color: #000000;">SETFOCUS</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> ,.T.<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#125;</span><br /><br />   <span style="color: #0000ff;">REDEFINE</span> BUTTONBMP ob136 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">136</span> <span style="color: #0000ff;">of</span> oDlg BITMAP <span style="color: #ff0000;">"NUEVO"</span> ;<br />     <span style="color: #0000ff;">action</span><span style="color: #000000;">&#40;</span>EDITA_MAR<span style="color: #000000;">&#40;</span>.T.,oRS<span style="color: #000000;">&#41;</span>,olbx:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,oLbx:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>  <span style="color: #0000ff;">WHEN</span> VALIACCE<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"A01"</span><span style="color: #000000;">&#41;</span>><span style="color: #000000;">2</span><br />     ob136:<span style="color: #000000;">cTooltip</span> := <span style="color: #ff0000;">"Crea nuevo registro"</span><br /><br />   <span style="color: #0000ff;">REDEFINE</span> BUTTONBMP ob137 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">137</span> <span style="color: #0000ff;">of</span> oDlg BITMAP <span style="color: #ff0000;">"EDITAR"</span> ;<br />     <span style="color: #0000ff;">action</span><span style="color: #000000;">&#40;</span>EDITA_MAR<span style="color: #000000;">&#40;</span>.F.,oRS<span style="color: #000000;">&#41;</span>,olbx:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,oLbx:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />     ob137:<span style="color: #000000;">cTooltip</span>:= <span style="color: #ff0000;">"modifica registro"</span><br /><br />     <span style="color: #0000ff;">REDEFINE</span> BUTTONBMP ob138 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">138</span> <span style="color: #0000ff;">of</span> ODLG BITMAP <span style="color: #ff0000;">"ELIMINA"</span> <span style="color: #0000ff;">ACTION</span><span style="color: #000000;">&#40;</span>ELIM_MAR<span style="color: #000000;">&#40;</span>oRS,oLBx<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />     ob138:<span style="color: #000000;">cTooltip</span>:= <span style="color: #ff0000;">"Elimina registro"</span><br /><br />     <span style="color: #0000ff;">REDEFINE</span> BUTTONBMP ob139 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">139</span> <span style="color: #0000ff;">of</span> ODLG BITMAP <span style="color: #ff0000;">"IMPRESORA"</span>;<br />     <span style="color: #0000ff;">action</span><span style="color: #000000;">&#40;</span>olbx:<span style="color: #000000;">gotop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,olbx:<span style="color: #000000;">report</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,olbx:<span style="color: #000000;">gobottom</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />     ob139:<span style="color: #000000;">cTooltip</span>:= <span style="color: #ff0000;">"Imprime"</span><br /><br />     <span style="color: #0000ff;">REDEFINE</span> BUTTONBMP ob139 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">140</span> <span style="color: #0000ff;">of</span> ODLG BITMAP <span style="color: #ff0000;">"EXCEL"</span> <span style="color: #0000ff;">ACTION</span><span style="color: #000000;">&#40;</span>EXCEL_MAR<span style="color: #000000;">&#40;</span>oRS,oMeter<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />     ob139:<span style="color: #000000;">cTooltip</span>:= <span style="color: #ff0000;">"Listado Articulos a Excel"</span><br /><br />     <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTON</span> oB450 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">450</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">&#40;</span>odlg:<span style="color: #000000;">end</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</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: #B900B9;">// VALID LSALE</span><br />   oRS:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />     oCon:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">RETURN</span> .T.<br /><br /><span style="color: #00C800;">STATIC</span> <span style="color: #00C800;">FUNCTION</span> SKIPPER<span style="color: #000000;">&#40;</span> oRsx, nSkip <span style="color: #000000;">&#41;</span><br /> <span style="color: #00C800;">LOCAL</span> nRec := oRsx:<span style="color: #000000;">AbsolutePosition</span><br /> oRsx:<span style="color: #0000ff;">Move</span><span style="color: #000000;">&#40;</span> nSkip <span style="color: #000000;">&#41;</span><br /> <span style="color: #00C800;">IF</span> oRsx:<span style="color: #000000;">EOF</span>; oRsx:<span style="color: #000000;">MoveLast</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #00C800;">ENDIF</span><br /> <span style="color: #00C800;">IF</span> oRsx:<span style="color: #000000;">BOF</span>; oRsx:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span> oRsx:<span style="color: #000000;">AbsolutePosition</span> - nRec <span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">FUNCTION</span> FILTRA_MAR<span style="color: #000000;">&#40;</span>cBuscar,oRS,oLBx<span style="color: #000000;">&#41;</span><br /> <span style="color: #00C800;">IF</span> LEN<span style="color: #000000;">&#40;</span>ALLTRIM<span style="color: #000000;">&#40;</span>cBuscar<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>><span style="color: #000000;">0</span><br />     oRs:<span style="color: #000000;">Filter</span>:= <span style="color: #ff0000;">"descripcion LIKE"</span> + <span style="color: #ff0000;">"  '*"</span> + ALLTRIM<span style="color: #000000;">&#40;</span>cBuscar<span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"*' "</span><br /> <span style="color: #00C800;">ELSE</span><br />     oRs:<span style="color: #000000;">Filter</span>:= <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">ENDIF</span><br /> oRs:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /> oLBx:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #00C800;">FUNCTION</span> EDITA_MAR<span style="color: #000000;">&#40;</span>lNuevo,oRS<span style="color: #000000;">&#41;</span><br /> <span style="color: #00C800;">LOCAL</span> oG114,oG102,lGraba:=.F.,oDlg,oB308,oB502,nBookMark,;<br /> cCodigo := SPACE<span style="color: #000000;">&#40;</span><span style="color: #000000;">20</span><span style="color: #000000;">&#41;</span>,;<br /> cDescri := SPACE<span style="color: #000000;">&#40;</span><span style="color: #000000;">50</span><span style="color: #000000;">&#41;</span>,;<br /> nPrecio := <span style="color: #000000;">0</span>,;<br /> nMaximo := <span style="color: #000000;">0</span><br /><br /> <span style="color: #00C800;">IF</span> !lnuevo<br />        cCodigo := oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"codigo"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span><br />        cDescri := oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"descripcion"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</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;">RESOURCE</span> <span style="color: #ff0000;">"ODLG_ARTEDIMYSQL"</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"DATOS ARTICULO "</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> oG114 <span style="color: #0000ff;">VAR</span> cCodigo <span style="color: #0000ff;">ID</span> <span style="color: #000000;">101</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">WHEN</span> lNuevo <span style="color: #0000ff;">UPDATE</span> <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@!"</span> ;<br /> <span style="color: #0000ff;">valid</span> <span style="color: #000000;">&#40;</span>IIF<span style="color: #000000;">&#40;</span>EXISTE_CODIGO<span style="color: #000000;">&#40;</span>cCodigo,oRS<span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#40;</span>cCodigo:=SPACE<span style="color: #000000;">&#40;</span><span style="color: #000000;">20</span><span style="color: #000000;">&#41;</span>,oG114:<span style="color: #000000;">oJump</span>:=oG114,oG114:<span style="color: #0000ff;">REFRESH</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>,.T.<span style="color: #000000;">&#41;</span>,.T.<span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">// valid (IIF(!EXISTE_CODIGO(cCodigo,oRS),oDlg:END(),.T.),.T.)</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> oG102 <span style="color: #0000ff;">VAR</span> cDescri <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> <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"@!"</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> BUTTONBMP oB308 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">501</span> <span style="color: #0000ff;">OF</span> oDlg BITMAP <span style="color: #ff0000;">"GRABAR"</span> <span style="color: #0000ff;">WHEN</span> !EMPTY<span style="color: #000000;">&#40;</span>cCodigo<span style="color: #000000;">&#41;</span> <span style="color: #0000ff;">ACTION</span>; <span style="color: #B900B9;">// .AND. (VALIACCE("A01")=3 .AND. lNuevo .OR. VALIACCE("A01")=4)</span><br /> <span style="color: #000000;">&#40;</span>lGraba:=.T.,oDlg:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /> oB308:<span style="color: #000000;">cTOOLTIP</span>:= <span style="color: #ff0000;">"Grabar"</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> BUTTONBMP oB502  <span style="color: #0000ff;">ID</span> <span style="color: #000000;">502</span>  <span style="color: #0000ff;">OF</span> oDlg BITMAP <span style="color: #ff0000;">"SALIR"</span> <span style="color: #0000ff;">ACTION</span><span style="color: #000000;">&#40;</span>oDlg:<span style="color: #000000;">END</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg<br /><br /> <span style="color: #00C800;">IF</span> lGraba<br />    <span style="color: #00C800;">IF</span> lNuevo<br />             oRS:<span style="color: #000000;">AddNew</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">ENDIF</span><br />    nBookMark:=oRs:<span style="color: #000000;">BookMark</span>                         <span style="color: #B900B9;">// Marcamos el puntero del nuevo Registro y...></span><br />        oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"codigo"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span>      := cCodigo<br />        oRS:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"descripcion"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">value</span> := cDescri<br />        oRS:<span style="color: #000000;">Sort</span>:=<span style="color: #ff0000;">"descripcion"</span><br />        oRs:<span style="color: #000000;">BookMark</span>:=nBookMark                          <span style="color: #B900B9;">//  ...posicionamos el puntero en el nuevo registro para mostrarlo en el listbox ordenado</span><br />                                                         <span style="color: #B900B9;">//  Esto solo cuando queremos mostrar el lisbox ordenado, en este caso por descripción</span><br />        oRS:<span style="color: #0000ff;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />  <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">///////////////  VALIDAMOS SI EXISTE EL CODIGO INGRESADO //////////////////</span><br /><span style="color: #00C800;">FUNCTION</span> EXISTE_CODIGO<span style="color: #000000;">&#40;</span>cCodigo,oRS<span style="color: #000000;">&#41;</span><br /> <span style="color: #00C800;">LOCAL</span> nBookMark,oRsExis,lBusca:=.F.<br /> <span style="color: #00C800;">IF</span> EMPTY<span style="color: #000000;">&#40;</span>cCodigo<span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">RETURN</span> .F.<br /> <span style="color: #00C800;">ENDIF</span><br /> nBookMark:=oRs:<span style="color: #000000;">BookMark</span> <span style="color: #B900B9;">// guardamos el puntero actual del recordset para reestaablecerlo cuando el registro no existe</span><br /> oRS:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /> oRS:<span style="color: #000000;">Find</span>:=<span style="color: #ff0000;">"codigo LIKE"</span> + <span style="color: #ff0000;">" '%"</span> + ALLTRIM<span style="color: #000000;">&#40;</span>cCodigo<span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"%' "</span><br /> <span style="color: #00C800;">IF</span> !oRS:<span style="color: #000000;">EOF</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    <span style="color: #0000ff;">MSGINFO</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Código ya registrado"</span><span style="color: #000000;">&#41;</span><br />    lBusca:=.T.<br /> <span style="color: #00C800;">ENDIF</span><br /> oRs:<span style="color: #000000;">BookMark</span>:=nBookMark   <span style="color: #B900B9;">// aqui se reestablece el puntero del recordset</span><br /><span style="color: #00C800;">RETURN</span> lBusca<br /><br /><span style="color: #00C800;">FUNCTION</span> ELIM_MAR<span style="color: #000000;">&#40;</span>oRS,oLbx<span style="color: #000000;">&#41;</span><br /> <span style="color: #00C800;">IF</span> MSGYESNO<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"esta seguro de eliminar este registro?"</span>,<span style="color: #ff0000;">"Elimina"</span><span style="color: #000000;">&#41;</span><br />        oRS:<span style="color: #000000;">Delete</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">IF</span> !oRs:<span style="color: #000000;">EOF</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />           oRs:<span style="color: #000000;">MoveNext</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">ELSE</span><br />             oRs:<span style="color: #000000;">MovePrevious</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">ENDIF</span><br />        oRS:<span style="color: #0000ff;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />        oLbx:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /> <span style="color: #00C800;">ENDIF</span><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:4t2rc46d]
ADO con SQL comando nativos.
Amigos: Que necesito y donde lo consigo.. para usar ADO con SQL Server y usar lo comandos nativos SQL. Después de saber un poco mas de SQL probare el ADORDD. Muchas gracias. Ruben Fernandez.
ADO con SQL comando nativos.
No necesitas nada, Windows trae instalado todo, el proveedor ADO para SQL Server. Solo necesitarias un SQL Servers instalado y listo, ha claro y la cadena de conexion. De ahi en fuera, tienes todo puesto para comenzar a utilizar ADO directamente desde tu programa FW.
ADO con SQL comando nativos.
Gracias Rene. Saludos Ruben Fernandez.
ADO con SQL comando nativos.
Master: Y donde hayar DOC para empezar a tomarle el hilo ? Saludos
ADO connect string to Outlokk
Anyone has the con string to Outlook?
ADO connect string to Outlokk
[code=fw:1mnx8jo2]<div class="fw" id="{CB}" style="font-family: monospace;">strConnect = _T<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Provider=Microsoft.Jet.OLEDB.4.0;Outlook 9.0;"</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"MAPILEVEL=;DATABASE=C:<span style="color: #000000;">\\</span>Temp<span style="color: #000000;">\\</span>;"</span><span style="color: #000000;">&#41;</span></div>[/code:1mnx8jo2] Another way (not sure which one is the right one) [url:1mnx8jo2]https&#58;//support&#46;microsoft&#46;com/en-us/kb/275262[/url:1mnx8jo2]
ADO connect string to Outlokk
Thanks Antonio
ADO connect string to Outlokk
How can I open one of the outlook folders?
ADO connection property ""Maximum Open Rows""
Does anyone knows how to change this property? Its seems its read only with a value of zero in MySql.
ADO connection property ""Maximum Open Rows""
Antonio, Please review this: [url:3wu39uoj]http&#58;//microsoft&#46;public&#46;data&#46;ado&#46;narkive&#46;com/miSIESQG/maximum-open-rows-property-is-read-only[/url:3wu39uoj]
ADO connection property ""Maximum Open Rows""
You can try this SELECT FIRST 1000 * FROM table look this too <!-- l --><a class="postlink-local" href="http://fivetechsupport.com/forums/viewtopic.php?f=3&t=26834#p148988">viewtopic.php?f=3&t=26834#p148988</a><!-- l --> Best regards,
ADO ejecutar
Hola buen día, como sería el equivalente de oCon:Execute( cSQL ) con ADO?
ADO ejecutar
With ADO, we can use oCn:Execute( cSql )
ADO ejecutar
Mr. Rao, gracias por responder. me da error: Error description: Error ADODB.RecordSet:_ACTIVECONNECTION/0 S_OK: EXECUTE como sería la sintaxis, aclaro que estoy trabajando con DBFs, no con SQL
ADO en forma nativa
Saludos Existe alguna version de FWH que maneje ADO en forma nativa? Es decir, sin librerias de terceros? Gracias
ADO en forma nativa
Desde hace tiempo, busca en tu source ADOFUNCS.PRG Qué versión tienes?
ADO en forma nativa
Gracias Donde veo un ejemplo de su uso?
ADO en forma nativa
Sería más fácil, para ayudarnos, si informamos de la versión de Fwh que utilizamos y si es Harbour/xHarbour, compilador de C, etc. Aquí tienes información <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=19&t=27296&hilit=empezando+con+ado#p151744">viewtopic.php?f=19&t=27296&hilit=empezando+con+ado#p151744</a><!-- l --> aunque en el foro hay muchos posts que hacen referencia a este tema
ADO enhansed TwBrowse ?
To All Working with a local access table and FWH Twbrowse seems to work with decent responce in painting the listbox .. BUT .. connecting to a SQL server using ADO and FW Twbrowse is very slow .. The ( fwh ) Browse will start and you will see a corner in the left open and sit there till Twbrowse can get it's 'bearings'. I realize that Twbrowse has to figure out it's parameters. top, bottom, recno?? but it is painfully slow. Even worse is Hernan's TwBrowse replacement class .. it never opens the recordset... and looking at the code .. it doesn't even take into consideration ADO .. just rdd and I am not using an rdd to calc the recordset. Is there a way to modify either FW TWbrowse or Hernan's Twbrowse to give any better performance with ADO. Thanks Rick Lipkin
ADO enhansed TwBrowse ?
Rick, Have you already tested the free ADORDD that we have published ? Browses work very fine with it
ADO enhansed TwBrowse ?
Antonio To be honest with you .. no, I have not tried the adordd. Would you be so kind as to send it to my private e-mail .. I will give it a good test.. I have been following your development .. does the download include a brief readme on the syntax .. for the connection strings ?? I guess the .ch would tell me a great deal as well .. Be anxious to see how it works. Rick Lipkin <!-- e --><a href="mailto:lipkinrm29063@yahoo.com">lipkinrm29063@yahoo.com</a><!-- e -->
ADO enhansed TwBrowse ?
Rick, Already sent the email <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
ADO enhansed TwBrowse ?
Rick: Where are your placing the RecordSet Cursor ? For browsing my best advice is to place the cursor on the client size because in the server size it takes ALOT of time on retrieving data. Have you modified the gotop, gobottom, bskip and blogiclen blocks ?
ADO enhansed TwBrowse ?
Rene I am using the 'standard' code .. I presume the recordset is being cached to the local workstation ? Here is the code: // access.prg #include "Fivewin.ch" Static lOK,oWND1,oBRW,oBROW,oBROW2 Static oSAY, cSAY, oSAY1, cSAY1 //------------------------------------------- Func Access() LOCAL oErr, SAYING, cFILENUM, oCN, cNAME, nLEN, nPOS, oRs, oDLG LOCAL lOK SET CENTURY on SET EPOCH to 1990 SET DELETED on oRs := CREATEOBJECT( "ADODB.Recordset" ) TRY oRS:Open( "SELECT * FROM CERT_DATA order by Name", "Provider=SQLOLEDB;Data Source=WEBDB02;Initial Catalog=DRUG_CONTROL;User Id=drugcontroluser;Password=r2x6j3q4", 1,3 ) CATCH oErr MsgInfo( "Error in Opening CERT_DATA table" ) RETURN NIL END TRY * oRs:MoveFirst() _CertBrow(oRs ) Return(nil) //-------------------------------------------------------- STATIC FUNCTION _CertBrow( oRs ) LOCAL nRec, oDLG lOK := .F. DEFINE WINDOW oWnd1 ; FROM 3,1 to 30,100 ; Menu Buildmenu(oRS); TITLE "REGISTRATION Registration Information Browse" @ 0,0 LISTBOX oBrw FIELDS ; oRs:Fields( "name" ):Value,; oRs:Fields( "addr1" ):Value,; oRs:Fields( "addr2" ):Value,; oRs:Fields( "addr3" ):Value,; oRs:Fields( "city" ):Value,; oRs:Fields( "state" ):Value,; oRs:Fields( "zip" ):Value,; oRs:Fields( "zip4" ):Value,; oRs:Fields( "schd" ):Value,; dtoc( oRs:Fields( "expir_date" ):Value),; dtoc( oRs:Fields( "init_date" ):Value ); SIZES 300,100,100,100,80,80,80,80,80; HEADERS "Name",; "Address1 ",; "Address2 ",; "Address3 ",; "City ",; "State",; "Zip ",; "Zip4 ",; "Schd ",; "Expire Date",; "Init_date "; ON DBLCLICK( MsgInfo( "Mark Record to Keep" ) ); UPDATE oBrw:bLogicLen := { || oRs:RecordCount } oBrw:bGoTop := { || oRs:MoveFirst() } oBrw:bGoBottom := { || oRs:MoveLast() } oBrw:bSkip := { | nSkip | Skipper( oRs, nSkip ) } oBrw:cAlias := "ARRAY" oWND1:oClient := oBRW ACTIVATE WINDOW oWND1 ; VALID ( IIF( !lOK, _LwmfsClose(.T., oRs), .F. )) RETURN NIL //------------------------ Static FUNCTION _LwmfsClose( lCLEAN, oRS ) IF lCLEAN = .T. lOK := .T. oBRW:cALIAS := nil oRs:Close() ENDIF RETURN(.T.) //-------------------------------------- Static FUNCTION BuildMenu( oRS ) LOCAL oMenu1 MENU oMenu1 MENUITEM "&Find ..." // ; * ACTION ( _DocFind( oRS ), ; * oBRW:Refresh() ) ; * MESSAGE "Find a Site" MENUITEM "&Quit" ; ACTION oWnd1:END() ENDMENU RETURN( oMenu1 ) //------------------------------- STATIC FUNCTION SKIPPER( oRsx, nSkip ) LOCAL nRec := oRsx:AbsolutePosition oRsx:Move( nSkip ) IF oRsx:EOF; oRsx:MoveLast(); ENDIF IF oRsx:BOF; oRsx:MoveFirst(); ENDIF RETURN( oRsx:AbsolutePosition - nRec ) //---------------------- Static Func _Docfind(oRS) LOCAL cITEM, oDLG,olbx cITEM := "File Number" DEFINE DIALOG oDlg ; FROM 1, 3 to 18, 35 ; TITLE "Site Locate Routine" @ 0,0 LISTBOX oLBX var cITEM ; ITEMS { "File Number" } ; on LEFT DBLCLICK _FINDENTR(cITEM,oDLG,oRS) ; of oDlg SIZE 120,100 ; MESSAGE "Please select an Item" @ 6,4 BUTTON "&Ok" ; SIZE 25,10 of oDLG ; ACTION( _FINDENTR(cITEM, oDLG, oRS), ; oDLG:END(), cITEM := NIL ) ; DEFAULT @ 6,11 BUTTON "&Quit" ; SIZE 25,10 of oDLG ; ACTION oDlg:END() ACTIVATE DIALOG oDlg oDLG:END() RETURN( NIL ) //----------------------- Static FUNC _FINDENTR( cITEM,oDLG,oRS ) LOCAL cFIND, cTITLE, oDLG2 cFIND := "BOGUS" DO CASE CASE cITEM = "File Number" cFIND := SPACE(10) cTITLE := "Enter a File Number" ENDCASE DEFINE DIALOG oDlg1 ; FROM 14,10 to 21,44 ; TITLE cTITLE @ 1,1 GET cFIND of oDLG1 PICTURE "@!" @ 2,6 BUTTON "&Ok" ; SIZE 25,10 of oDLG1 ; ACTION ( GoGetum( cFIND, oRS, cITEM),; oDlg1:END(), oDLG:END() ) ; DEFAULT @ 2,13 BUTTON "&Quit" ; SIZE 25,10 of oDLG1 ; ACTION ( oDlg1:END(), oDLG:END() ) ACTIVATE DIALOG oDlg1 oDLG1:END() RETURN( NIL ) //--------------------------- Static FUNC GoGetum( cFIND,oRS, cITEM ) LOCAL SAYING, nRECNO, oBTN1,oBTN2 LOCAL lOK cFIND := ALLTRIM( cFIND ) DO CASE CASE cITEM = "File Number" oRs:Find("file_num = '"+cFIND+"'" ) IF oRs:eof oRs:MoveFirst() oRs:Find("file_num = '"+cFIND+"'" ) IF oRs:eof() Msginfo( "File Number "+cFind+" can not bre found" ) oRs:MoveFirst() ENDIF ENDIF RETURN(.T.) ENDCASE RETURN(NIL) // -- END
ADO enhansed TwBrowse ?
Rick, Check the source code of the ADORDD to see how we do it: oAdo := TOleAuto():New( "ADODB.Recordset" ) oAdo:CursorType = adOpenDynamic oAdo:CursorLocation = adUseClient oAdo:LockType = adLockPessimistic
ADO enhansed TwBrowse ?
Antonio and Fernando I am looking at the adordd.prg and I see how you are creating the recordset .. oADO := TOleAuto():New( "ADODB.Recordset" ) oAdo:CursorType = adOpenDynamic oAdo:CursorLocation = adUseClient oAdo:LockType = adLockPessimistic oAdo:Open( s_cQuery + s_cTableName, s_aConnections[ nWA ] ) //--- my code oRs := CREATEOBJECT( "ADODB.Recordset" ) TRY oRS:Open( "SELECT * FROM CERT_DATA order by Name", "Provider=SQLOLEDB;Data Source=WEBDB02;Initial Catalog=DRUG_CONTROL;User Id=drugcontroluser;Password=r2x6j3q4", 1,3 ) CATCH oErr MsgInfo( "Error in Opening CERT_DATA table" ) RETURN NIL END TRY Please excuse the dumb question .. what is the difference in : oADO := TOleAuto():New( "ADODB.Recordset" ) and oRs := CREATEOBJECT( "ADODB.Recordset" ) I take it that this is what you were driving at with a client cursor vs a server cursor ?? If that is correct .. does the last two parameters 1,3 .. still allow the client recordset update visability back and forth from other network clients ?? Being rdd .. how do I define field vars and how do I write them back .. can I do something like : Select 1 USE (AllTrim(cDbf)) VIA "ADORDD" TABLE AllTrim(cTable) SQL ; FROM AllTrim(cFrom) USER AllTrim(cUser) PASSWORD AllTrim(cPsw) then reference my vars with cWhatever := a->whatever and then write them back like a->whatever := cWhatever ? I take it record locks are still not relevant here since the database handles the oportunistic locking ?? 1,3 ) I am looking forward to seeing how this works .. I will let you all know sometime tomorrow .. Many thanks Rick Lipkin
ADO enhansed TwBrowse ?
Rick: I reviewed your code all seems to look all rigth, I mean, the movement blocks are correct but, you have to "prepare" your RecordSet BEFORE open the query. To "prepare" the cursor, you have to follow Antonio's instructions and use the ::CursorType, ::CursorLocation, and ::locktype properties before opening the recordset, if you don't prepare the recordset, the cursortype is Forward Only, the cursor location is on server size and the Locktype is Optimistic (default values), I guess that's why the browsing is slow.
ADO enhansed TwBrowse ?
Rick, > Select 1 USE (AllTrim(cDbf)) VIA "ADORDD" TABLE AllTrim(cTable) SQL ; FROM AllTrim(cFrom) USER AllTrim(cUser) PASSWORD AllTrim(cPsw) > Yes <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> > then reference my vars with cWhatever := a->whatever and then write them back like a->whatever := cWhatever ? > Right <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
ADO enhansed TwBrowse ?
Antonio I got a working browse with my code and YES .. the listbox is MUCH better when the recordset is cached locally. Still takes a while to 'fetch' the recordset .. but that is based on the connection to the server .. which is ( in my case here ) a considerable distance from my location. I have not tried multiple workstations updating records and the visability of those changes .. any thoughts there ?? What about indexes .. or TAGS .. generally speaking I was creating the ORDER by in the SQL statement as to how I want to see the records and on the relational tables .. opening a recordset with the sql clause .. WHERE ASSOCIATED_FILE_NUM ='"+cFILENUM+"'"+" order by date_" .. not even using an index. In traditional dbfcdx rdd .. there is a set scope .. or filter .. I see in the adordd code: STATIC FUNCTION ADO_SETFILTER( nWA, aFilterInfo ) local oADO := USRRDD_AREADATA( nWA )[ 1 ] oADO:Filter = SQLTranslate( aFilterInfo[ UR_FRI_CEXPR ] ) RETURN SUCCESS STATIC FUNCTION ADO_CLEARFILTER( nWA ) local oADO := USRRDD_AREADATA( nWA )[ 1 ] TRY oADO:Filter = "" #ifndef __XHARBOUR__ CATCH FINALLY #else CATCH oError Alert( oError:Operation ) END #endif RETURN SUCCESS How is that translated into rdd ?? ... set index to... set order to tag ... LOCATE ?? #command LOCATE [FOR <for>] [WHILE <while>] [NEXT <next>] ; [RECORD <rec>] [<rest:REST>] [ALL] => ; [ HB_AdoSetLocateFor( <(for)> ); ] ; __dbLocate( <{for}>, <{while}>, <next>, <rec>, <.rest.> ) I know this is still a work in progress .. MARVELOUS WORK so far !! Rick Lipkin
ADO enhansed TwBrowse ?
Rick, > I got a working browse with my code and YES .. the listbox is MUCH better when the recordset is cached locally. Still takes a while to 'fetch' the recordset .. but that is based on the connection to the server .. which is ( in my case here ) a considerable distance from my location. > You may try setting the recordset CacheSize value. We have not implemented it yet, but we plan to do it: oAdo:CacheSize := 50 > I have not tried multiple workstations updating records and the visability of those changes .. any thoughts there ?? > ADORDD uses oAdo:CursorType = adOpenDynamic so the changes should become visible from all workstations > What about indexes .. or TAGS We have not implemented them yet. Probably we will do it along this next weekend You can use SET FILTER TO <expression> and SET FILTER TO, to clear the filter. Same as Clipper. For SQL expressions, write them between quotation marks We are glad that you are enjoying the ADORDD <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
ADO enhansed TwBrowse ?
Antonio oAdo:CacheSize had no effect at any value .... but I am not complaining. This is a table with about 25k records .. and I have tested it at this location ( on the 'outer rim' ) and close to the core router. The closer to the core router .. the faster the 'fetch' Just thought I would let you know about the cachesize Rick Lipkin
ADO enhansed TwBrowse ?
Rick Thanks for the feedback <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
ADO error en la conexion...
Error description: Error ADODB.Recordset/14 DISP_E_BADPARAMCOUNT: OPEN Args: [ 1] = C SELECT * FROM Utenti [ 2] = C Provider=SQLOLEDB;Data Source=PCPEDRO\SQLEXPRESS;Initial Catalog=data_di_prova;UserID=sa;Password=1234;Persist Security Info=True [ 3] = N 1 [ 4] = N 1 Mi codigo es el siguiente: [code:22k0j0v2] oRs &#58;= CREATEOBJECT&#40; "ADODB&#46;Recordset" &#41; cSQL &#58;= "SELECT * FROM Utenti" oRs&#58;Open&#40; cSQL, "Provider=SQLOLEDB;Data Source=PCPEDRO\SQLEXPRESS;Initial Catalog=data_di_prova;UserID=sa;Password=1234;Persist Security Info=True", adOpenKeyset, adLockReadOnly &#41; // 1, 3 oRs&#58;MoveFirst&#40;&#41; WHILE !oRs&#58;EOF ? oRs&#58;Fields&#40; "nome" &#41;&#58;Value oRs&#58;MoveNext&#40;&#41; ENDDO oRs&#58;Close&#40;&#41;[/code:22k0j0v2] El usuario "sa" ya està creado con la password 1234 y accedo a esta tabla desde el MS SQL Server Management Studio Express con este usuario y pass. Alguna idea? FWH2.7, xHarbour 0.99.51 P.D. No puedo hacer las pruebas con la nueva clase porque me da errores varios, porque seguramente con la version de xharbour que tengo no van de acuerdo y por ahora no puedo actualizar FW. Gracias.
ADO error en la conexion...
Parece cosa de locos... hace 5 dias que estoy con este problema, cuando decido poner el mensaje en el foro despues de 5 minutos descubro que el string de conexion que uso no era el adecuado.... Gracias a un mensaje de RF que dejó un link con todas las conexiones a sql <!-- m --><a class="postlink" href="http://www.connectionstrings.com/">http://www.connectionstrings.com/</a><!-- m --> y ahi encontré la que necesito... "Provider=SQLNCLI;Server=PCPEDRO\SQLEXPRESS;Database=data_di_prova;Uid=sa;Pwd=1234" en vez de "Provider=SQLOLEDB;Data Source=PCPEDRO\SQLEXPRESS;Initial Catalog=data_di_prova;UserID=sa;Password=1234;Persist Security Info=True" Gracias
ADO events
Hi ! It's needful to adopt one event in ADO objects . I found an VFP sample , it demonstrate what I want to do : #DEFINE C_VFPCOMCLASS 'vfpcom.comutil' oVFPCOM = CreateObject(C_VFPCOMCLASS) oRecordSet = CreateObject('ADODB.RECORDSET') oRecordSet.CursorType = 3 && adOpenStatic oRecordSet.LockType = 1 && adLockReadOnly oRecordSet.Open('SELECT * FROM AUTHORS', + ; 'Provider=sqloledb;Server=MYSQL1;' + ; 'Initial Catalog= pubs;UId=sa;PWD=; ') oEvents = CreateObject('adoevents') nError = oVFPCOM.BindEvents(oRecordSet, oEvents) oRecordSet.MoveNext DEFINE CLASS adoevents AS Session PROCEDURE WillMove(adReason, adStatus, pRecordset) WAIT WINDOW 'Moving one record...' NOWAIT ENDPROC ENDDEFINE The problem is that this example is adapted to VFP COM object . So my question it will second : can I manage events of recordsets without COM object ( as in sample ) ? Only with ADO objects ? If yes , can you show some source how to do that ? It's needful to recognize movings events on recordset and then to do some things . Many thanks in adcvance ! With best regards ! Rimantas
ADO filtering
Hello friends, I need to perform a filter in ADO using a date, and it gives me an error: [code=fw:3ssfm8jl]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />   cFilter := <span style="color: #ff0000;">"HIREDATE >= FW_ValToSQL(DATE())"</span><br />   oRs:<span style="color: #000000;">Filter</span> := cFilter<br /><br /><br /> </div>[/code:3ssfm8jl] What am I doing wrong? Thank you and a greeting
ADO filtering
I save the filter expresion in a field of the report´s table.
ADO filtering
What about [code=fw:3799ngfb]<div class="fw" id="{CB}" style="font-family: monospace;">cFilter := <span style="color: #ff0000;">"HIREDATE >= "</span>+FW_ValToSQL<span style="color: #000000;">&#40;</span> DATE<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />oRs:<span style="color: #000000;">Filter</span> := cFilter</div>[/code:3799ngfb]
ADO filtering
Thank you, that works, but I need to store the full filter in a database.
ADO for ADS?
Mr. Rao; I now see how you have been working on making standardized ADO functions that work across a number of different sql engines. I have been using ADS for many years quite successfully. I mostly work via ACE32 and the ADS RDDs. I would assume that it is just as possible to work with ADS using ADO. If so, why not make the FW ADO functions compatible with ADS? Can I help? I already have a TAdsQuery() class to execute sqls and even allows you to treat a returning cursor as an array or as TData object. as in: [code=fw:15u45rea]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">//------------------------------------------------------------------------------</span><br /><span style="color: #00C800;">METHOD</span> SaveIdImage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #00C800;">CLASS</span> Tpatient<br />   <span style="color: #00C800;">LOCAL</span> binImage, oQ<br /><br />   <span style="color: #00C800;">IF</span> ::<span style="color: #000000;">cIDImageFile</span> != <span style="color: #00C800;">NIL</span> .AND. !EMPTY<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">cIDImageFile</span> <span style="color: #000000;">&#41;</span> .AND. file<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">cIDImageFile</span> <span style="color: #000000;">&#41;</span><br /><br />      binImage := MEMOREAD<span style="color: #000000;">&#40;</span> ::<span style="color: #000000;">cIDImageFile</span> <span style="color: #000000;">&#41;</span><br /><br />      oQ := TAdsQuery<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      oQ:<span style="color: #000000;">cSql</span> := <span style="color: #ff0000;">"UPDATE patients SET [image] = :bin_data WHERE recno = '$1$'"</span><br />      oQ:<span style="color: #000000;">aSubstitutes</span> := <span style="color: #000000;">&#123;</span> ::<span style="color: #000000;">oPatTbl</span>:<span style="color: #000000;">VarRecNo</span> <span style="color: #000000;">&#125;</span> <span style="color: #B900B9;">//StrTrans '$1$' for array contents on [1]</span><br />      oQ:<span style="color: #000000;">AdsPrepareSQL</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> &nbsp;<span style="color: #B900B9;">//to prepare a paraetized query</span><br />      oQ:<span style="color: #000000;">SetParameters</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"bin_data"</span>, binImage, <span style="color: #ff0000;">"B"</span> <span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">//Parameterized query</span><br />      oQ:<span style="color: #000000;">RunAdsPreparedSql</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      oQ:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #00C800;">ENDIF</span><br /><br />   <span style="color: #B900B9;">//fErase( ::cIDImageFile )</span><br />   <span style="color: #B900B9;">//ClearTmpfiles()</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /> </div>[/code:15u45rea] Reinaldo.
ADO for ADS?
Honestly I still love ADS and miss ADS. But for the sheer size of our data, I would not have left ADS and migrated to Oracle. You are aware that there are OLEDB providers for ADS and we can work with ADO. But knowing both, my advice for you is to continue what you are doing. Do not go the ADO way using ADS' OleDb providers. Please never think again. Please stick to what you are doing. ADS, using ace.lib is still the best way and what you are doing is still the best. Now about how do we deal with the results of ADS SqlQuery. If you are using TData or TDataBase that is good.
ADO function to append table not DBF into a recordset
Hello, Is there an FW ADO function to import or append an existing table accessed via ADO, not a DBF file, into a recordset? Thank you.
ADO no me funciona en una tabla en especifico
Hola a todos, ... no tienen idea de lo que he buscado informacion sobre esto en la red, y finalmente he caido aqui, pues he llegado a la conclusion de que solamente Ustedes podran darme luz en esto. Se trata del ampliamente expuesto en la red, problema del mensaje de error que aparece: "No se puede encontrar la fila para su actualizacion: algunos valores han cambiado desde la ultima vez que se leyo" A partir de alli, parece que la conexion con el recorset desaparece, pues todas las instrucciones que siguen aparecen con error, y nunca se ejecuta. TOdo esto aparece al ejecutar una instruccion ::oRs:Update(). No me ocurre con todas las tablas de la base de datos, sino con una sola de ellas (hasta ahora no he comprobado con todas las tablas). A TODAS las tablas de la base de datos se le ha agregado un columna, al inicio, llamada "noreg", entero, auto_increment que lo utilizo como llave primaria. Estoy usando xHarbour 0.99.3, FWH24, Borland 5.5.1, MySQL 3.23 (en modo local) e instale MyODBC 2.50 Hasta ahora he tratado lo siguiente: 1.- realizo las sustituciones con ::oRs:Fields(n):value := 'valor a cambiar', cambie a ::oRs:Fields('nombre del campo'):value := ´valor a cambiar', y el error persiste. 2.- realizo el ::oRs:Update() al final de las sustituciones. Cambie a realizar las sustituciones por ::oRs:Update('nombre del campo', 'valor a cambiar'), y el error persiste. 3.- Utilizo OPTION=3, y la cambie a OPTION=16387, y el error persiste. 4.- marque las dos primeras opciones en la configuracion de MyODBC en el COntrol Panel, y el error persiste. 5.- Ejecute todo con la opcion de Trazas seleccionada en Control Panel, y el archivo no me dice de nikngun error (o no se interpretarlo), y tambien seleccione la opcion de trazas con OPTION=7, y lo mismo. 6.- He leido todas las news de FW, y veo que nadie reporta esto. 7.- He buscado en la red, y aunque mucha gente lo reporta, nadie llega a una solucion. Algunos suguieren soluciones para VB, tales como utilizar los campos numericos en formato DOUBLE y no FLOAT, agregar un campo timestamp "dummy" a las tablas. Esto no lo he tratado aun. Mi string de conexion es: DRIVER={MySQL}; SERVER=localhost; DATABASE=XXXXXXX; UID=jllinas; PWD=XXXXXXXX; OPTION=16387 AL momento de conectar, el CursorLocation es adUseClient. Para crear el recordset hago: ::oRs := CreateObject("ADODB.Recordset") ::oRs:Open( cQuery, uConn, nCursorType, nLockType, nOptions ) donde nCursorType es adOpenKeySet, nLockType es adLockOptimistic y nOptions es adCmdUnknown He comprobado, y realmente el registro no se ha movido, comprobado entre la lectura y la escritura. ... no se que mas comprobar, a ver que estoy haciendo mal... Me estoy tirando de los pelos que ya no me quedan! AYUDA.... POR FAVOR !!!!!
ADO no me funciona en una tabla en especifico
Hola a todos, ... no tienen idea de lo que he buscado informacion sobre esto en la red, y finalmente he caido aqui, pues he llegado a la conclusion de que solamente Ustedes podran darme luz en esto. Se trata del ampliamente expuesto en la red, problema del mensaje de error que aparece: "No se puede encontrar la fila para su actualizacion: algunos valores han cambiado desde la ultima vez que se leyo" A partir de alli, parece que la conexion con el recorset desaparece, pues todas las instrucciones que siguen aparecen con error, y nunca se ejecuta. TOdo esto aparece al ejecutar una instruccion ::oRs:Update(). No me ocurre con todas las tablas de la base de datos, sino con una sola de ellas (hasta ahora no he comprobado con todas las tablas). A TODAS las tablas de la base de datos se le ha agregado un columna, al inicio, llamada "noreg", entero, auto_increment que lo utilizo como llave primaria. Estoy usando xHarbour 0.99.3, FWH24, Borland 5.5.1, MySQL 3.23 (en modo local) e instale MyODBC 2.50 Hasta ahora he tratado lo siguiente: 1.- realizo las sustituciones con ::oRs:Fields(n):value := 'valor a cambiar', cambie a ::oRs:Fields('nombre del campo'):value := ´valor a cambiar', y el error persiste. 2.- realizo el ::oRs:Update() al final de las sustituciones. Cambie a realizar las sustituciones por ::oRs:Update('nombre del campo', 'valor a cambiar'), y el error persiste. 3.- Utilizo OPTION=3, y la cambie a OPTION=16387, y el error persiste. 4.- marque las dos primeras opciones en la configuracion de MyODBC en el COntrol Panel, y el error persiste. 5.- Ejecute todo con la opcion de Trazas seleccionada en Control Panel, y el archivo no me dice de nikngun error (o no se interpretarlo), y tambien seleccione la opcion de trazas con OPTION=7, y lo mismo. 6.- He leido todas las news de FW, y veo que nadie reporta esto. 7.- He buscado en la red, y aunque mucha gente lo reporta, nadie llega a una solucion. Algunos suguieren soluciones para VB, tales como utilizar los campos numericos en formato DOUBLE y no FLOAT, agregar un campo timestamp "dummy" a las tablas. Esto no lo he tratado aun. Mi string de conexion es: DRIVER={MySQL}; SERVER=localhost; DATABASE=XXXXXXX; UID=jllinas; PWD=XXXXXXXX; OPTION=16387 AL momento de conectar, el CursorLocation es adUseClient. Para crear el recordset hago: ::oRs := CreateObject("ADODB.Recordset") ::oRs:Open( cQuery, uConn, nCursorType, nLockType, nOptions ) donde nCursorType es adOpenKeySet, nLockType es adLockOptimistic y nOptions es adCmdUnknown He comprobado, y realmente el registro no se ha movido, comprobado entre la lectura y la escritura. ... no se que mas comprobar, a ver que estoy haciendo mal... Me estoy tirando de los pelos que ya no me quedan! AYUDA.... POR FAVOR !!!!!
ADO no me funciona en una tabla en especifico
<!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> Sorry, Wrong place.... moved to spanish forum!
ADO no me funciona en una tabla en especifico
Julio yo lo creo de la sig. manera y me ha funcionado. oEMPRESAS := CREATEOBJECT( "ADODB.Recordset" ) oEmpresas:CursorLocation := 3 oEmpresas:CursorType := 3 oEmpresas:LockType := 3 oEmpresas:MaxRecords := 0 espero te funcione.
ADO no me funciona en una tabla en especifico
Fernando, Gracias adelantadas por contestar... En efecto, comparando la forma que lo hago con lo que me expresas aqui, tenía solo diferencia en el ::oRs:CursorType, que al tu colocarle un valor de 3, significa que has seleccionado adOpenStatic. Ya habia observado que algunos otros compañeros asi lo hacian. Lo cambié y el problema persiste. Lo probe de nuevo con la tabla en interes, y no funciona (reporta el mismo error), mientras que en otras tablas el problema no ocurre, y el ABM ocurre normalmente. Una cosa que no entendi: incluyes aqui el parámetro ::oRs:MaxRecords := 0. ¿Que significa esto? no lo habia visto por ninguna otra parte... Por otro lado, y ahora para todos: ¿En ADO existen nombres reservados, que no puedan utilizarse para nombres de columnas? Se que en MySQL existen, y ya pase por esta, pero no he verificado en ADO.... ¿Alguien sabe de esto? Gracias a todos,
ADO no me funciona en una tabla en especifico
Julio , segun lo que indica la documentacion es esto. Nos permite fijar el número máximo de registros que aceptará el objeto Recordset. El valor por defecto es 0 e indica que no existirá límite. si quieres puedes anviarme la tabla o la bd, para ver si tambien a mi presenta los mismo problemas. saludos fernando sandoval ruiz
ADO no me funciona en una tabla en especifico
Gracias Fernando, Dos cosas nuevas en esto: - Primero, no se como pasarte la tabla en la cual tengo problemas. Yo utilizo MySQL, y todo depende de con cual motor de BD vas a buscar reproducir el mismo error que me pasa. Puedo enviarte la tabla en DBF a partir de la cual he creado la de MySQL (solo tiene 10 registros para probar), pero tú me diras. - "Conversando" con José Luis Capel por MSN, me ha sugerido que integre las pruebas con el metodo Supports(), a ver si es que los metodos ::oRs:Update() y la propiedad ::oRs:BookMark estan soportadas por el proveedor (MySQL). El caso es que SI estan soportadas ambas. Anexo mas abajo el metodo Save(), que es con el cual me ocurre el problema. Se trata del mismo método Save() propuesto por JLC y que fuera publicado en su Blog..... pero muy, muy modificado, pues trato los valores en un buffer, y luego simplemente los grabo con el Update(). ----------------------------------------- METHOD Save() CLASS tAdoRs LOCAL oError LOCAL lResult LOCAL n, nFields LOCAL lChange := .F. LOCAL uBkMrk LOCAL cType lResult := .T. TRY if ::lNeedUpd if ::lBuffer for n := 1 to len( ::aBuffer ) if ::oRs:Fields(n-1):value <> ::aBuffer[n] cType := ::FieldType( n ) cName := ::FieldName( n ) do case case cType = "D" ::oRs:Fields( cName ):value := if(::aBuffer[n]=CTOD(""), NIL, DTOC( ::aBuffer[n] ) ) otherwise ::oRs:Fields( cName ):value := ::aBuffer[n] endcase lChange := .T. endif next endif if lChange MsgInfo( "Soporta el metodo UPDATE(): "+IIF(::oRs:Supports( adUpdate ),"Si","No" ) ) MsgInfo( "Soporta la propiedad BOOKMARK: "+IIF(::oRs:Supports( adBookMark ),"Si","No" ) ) IF ::oRs:Status() == adRecModified ::oRs:Update() uBkMrk := ::Recno() ::oRs:Requery() ::Goto( uBkMrk ) ENDIF endif ::lNeedUpd := .F. endif CATCH oError lResult := .F. MsgStop(oError:Operation+CRLF+; oError:Description+CRLF+; "Tabla: "+::cAlias+CRLF+; "Columna: "+STR(n),"Ado Recordset - Método Save()") END RETURN lResult Gracias anticipadas por cualquier sugerencia...
ADO no me funciona en una tabla en especifico
Julio, Prepara, por favor, un ejemplo autocontenido que muestre el problema que indicas. A ver si vemos lo que te está pasando. Saludos, José Luis Capel
ADO no me funciona en una tabla en especifico
Julio: a. ¿Como creas el recordset? Muéstrame el código b. ¿Como haces para modificar un registro? Muéstrame el código c. ¿Como haces para grabar el registro? Muéstrame el código. El mensaje que te aparece: [quote:1ktva1aa]"No se puede encontrar la fila para su actualizacion: algunos valores han cambiado desde la ultima vez que se leyo" [/quote:1ktva1aa] A mi me ha aparecido cuando: a. El registro que voy a grabar ya no existe en el recordset. b. El recordset que me he traido no tiene clave primaria. Saludos, José Luis Capel
ADO no me funciona en una tabla en especifico
Cual es el link del articulo donde publico jcapel. si no es muy grabde la bd puedes enviarmela. gracias. fernando sandoval ruiz
ADO no me funciona en una tabla en especifico
Bueno, a ver si "mato" dos de un tiro: Primero, dejame comenzar con el último, Fernando: - Para ver las clases originales sugeridas por jcapel, puedes visitar su blog que esta en [url:1207ic2h]http&#58;//www&#46;capelblog&#46;com[/url:1207ic2h] - La tabla que me pides puedes descargarla en este enlace [url:1207ic2h]http&#58;//www&#46;ssp&#46;com&#46;do/clientes&#46;dbf[/url:1207ic2h] Ahora para lo que me pide José Luis: Debo comenzar por colocar a la disposición de todos las clases originales, propuestas por ti, modificadas por mi. Buscaré crear en mi blog un articulo donde comentaré los cambios que le he realizado. Por ahora, la puedes descargar de aqui [url:1207ic2h]http&#58;//www&#46;ssp&#46;com&#46;do/adoclass&#46;zip[/url:1207ic2h], el cual contiene las clases ADOCONN, ADORS y el archivo ADO.CH modificado. [quote:1207ic2h]a. ¿Como creas el recordset? muestrame el código[/quote:1207ic2h] Primero la conexion. Esto lo hago al momento de empezar con nuestro sistema, para conectar con ADO: [code:1207ic2h] oConexionAdo &#58;= tAdoConn&#40;&#41;&#58;New&#40;&#41; lConectado &#58;= oConexionAdo&#58;Open&#40; MIP &#41; CursorWait&#40;&#41; oTables &#58;= oConexionAdo&#58;OpenSchema&#40; adSchemaTables &#41; aFiles &#58;= &#123;&#125; DO WHILE !oTables&#58;EOF&#40;&#41; AADD&#40; aFiles, oTables&#58;Fields&#40;2&#41;&#58;value &#41; oTables&#58;MoveNext&#40;&#41; ENDDO oTables&#58;Close&#40;&#41; CursorArrow&#40;&#41; if len&#40;aFiles&#41; == 0 MsgAlert&#40;"No existen tablas sobre esta Base de datos, retornando&#46;&#46;&#46;", "Busqueda de Tablas con ADO"&#41; oConexionAdo&#58;Close&#40;&#41; QUIT endif [/code:1207ic2h] oCOnexionAdo es una variable (objeto) pública, MIP es la cadena de conexion, que para mi caso es: [code:1207ic2h] MIP &#58;= "DRIVER=&#123;MySQL&#125;; SERVER=localhost; DATABASE=richardcar; UID=jllinas; PWD=XXXXXXXX; OPTION=16387" [/code:1207ic2h] Luego, para crear el recordset, utilizo este código: [code:1207ic2h] oDbf &#58;= tAdoRs&#40;&#41;&#58;New&#40;&#41; oDbf&#58;oRs&#58;CursorLocation &#58;= adUseClient oDbf&#58;oRs&#58;CursorType &#58;= adOpenForwardOnly oDbf&#58;oRs&#58;LockType &#58;= adLockOptimistic lReturn &#58;= oDbf&#58;Open&#40; cQuery, oConexionAdo&#58;oConnection, adOpenKeyset, adLockOptimistic, adCmdUnknown, cAlias,, cOrder &#41; [/code:1207ic2h] [quote:1207ic2h]b. ¿Como haces para modificar un registro? Muéstrame el código[/quote:1207ic2h] Como puedes ver, para modificar un registro, siempre lo cargo a una variable tipo DATA de la clase ADORS que se llama ::buffer, y que es un arreglo simple y sencillo del registro donde está el puntero en el recordset. Este arreglo se accesa haciendo mencion a "nombre del recordset":"nombre de la columna" Por ejemplo, para la tabla que me da problemas, llamo "oClientes" al recorset, y para cambiar el valor en la columna llamada "nombre", simplemente hago [code:1207ic2h]oClientes&#58;Nombre &#58;= "JUAN PEREZ"[/code:1207ic2h] Pero todo esto se hace en el buffer. Si vez el método ON ERROR al final de la clase ADORS, podrás ver que allí se realiza este milagro (no es un truco de mi autoría... lo segui simplemente después de ver a muchos hacerlo así). Luego de esto, solo me queda grabar el registro... Para "cargar" el registro desde el recordset tengo la siguiente función: [code:1207ic2h] FUNCTION DBGET&#40; oDbf, lAgrega &#41; LOCAL nRecno &#58;= 1 IF lAgrega oDbf&#58;Blank&#40;&#41; ELSE oDbf&#58;Load&#40;&#41; ENDIF RETURN NIL [/code:1207ic2h] donde oDbf es la variable objeto del recorset (para mi ejemplo, oClientes). [quote:1207ic2h]c. ¿Como haces para grabar el registro? Muéstrame el código.[/quote:1207ic2h] Luego, para grabarlo, tengo otra función, parecida a la anterior, pero que "coloca" el registro en el recordset: [code:1207ic2h] FUNCTION DBPUT&#40; oDbf, lAgrega &#41; IF lAgrega oDbf&#58;Append&#40;&#41; oDbf&#58;Save&#40;&#41; ELSE oDbf&#58;Save&#40;&#41; ENDIF RETURN NIL [/code:1207ic2h] Creo que esto es todo. La tabla que me dá problemas la puedes descargar (en formato DBF) desde un enlace que incluí al principio de este mensaje. Ojala y puedas ver algo que no este yo viendo ahora !!! Gracias anticipadas,
ADO no me funciona en una tabla en especifico
Julio no se que problema haya, luego de hacer varias pruebas , el cambio el siguiente, oRs:Fields("Nombre"):= alltrim(cNombre) , no se harbour o xharbour agrege algun caracter al terminar de capturar o lo espacion en blanco no sean aceptados por ado. de echo tambien tengo el mismo problema con una tabla, que ya estaba funcionando bien. a el link donde esta la aplicacion no funciona, pero mandamelo a <!-- e --><a href="mailto:fernandosando@gmail.com">fernandosando@gmail.com</a><!-- e --> saludos. fernando sandoval ruiz
ADO no me funciona en una tabla en especifico
Julio, Mándame, por favor, un ejemplo autocontenido donde se pueda reproducir ese error que comentas. Saludos, José Luis Capel
ADO no me funciona en una tabla en especifico
Gracias José Luis, Voy a construirlo, incluyendo la creación de la tabla y cuando lo tenga te lo envío. Solo te enviaré el ejemplo, pues el resto de las clases modificadas por mi ya las tienes. Gracias de nuevo,