rochinha Posted May 15, 2022 Report Share Posted May 15, 2022 Amiguinhos, Encontrei o seguiten código, mas não acrescentei nele qualquer informação de onde, no Google não vireferência a nada. Sei que é do (x)Harbour, óbeveo! Citar #include "fivewin.ch" function main() public conn // HbConnection public cust // HbTable public onDBF := .t. // Se .f. o acesso sera via MySQL aNomes := { "JOSE","MARIA","ANTONIO","CARLOS","MANOEL","OTACILIO","RUBENS","DANILO","HEBRON" } aSobreNomes := { "DA SILVA","DA CRUZ","DOS SANTOS","DA COSTA","DE JESUS","SOBRINHO","FILHO","NETO","DAS DORES" } aSalarios := { 500,450,680,1250,3000,1800,2200,490,950 } aStruct := {} aadd( aStruct, { "NOME" , "C", 30, 0 } ) aadd( aStruct, { "SALARIO", "N", 14, 2 } ) aadd( aStruct, { "DATA" , "D", 8, 0 } ) if .Not. file("xbapi.dbf") dbCreate( "xbapi", aStruct ) endIf conn := TOleAuto():New( "XHbCom.HbConnection" ) cust := TOleAuto():New( "XHbCom.HbTable" ) cust:Connection := conn //' associate table with connection If .Not. onDBF logRes := conn:MedLogin( "127.0.0.1", "19C8", "root", "senha", "sqlj" ) If logRes <> 0 MsgStop("Unable to connect to Mediator. Please check if Mediator is running and you have customized connection parameters specified in call to MedLogin function") EndIf RddDriverName := "MEDNTX" Else RddDriverName := "DBFNTX" EndIf //? len(aNomes) //? len(aSobreNomes) //? len(aSalarios) //cust:DbCreate( "xbapi", aStruct, RddDriverName ) // Cria xbapi.dbf //cust:DbCreateIndex( "xbNome", "nome" ) // Cria o indice xbNome com o campo nome cust:DbUseArea( RddDriverName, "xbapi.dbf" ) //cust:DbSetIndex( "customer" ) if Cust:Reccount < 1 For rn = 1 To 9 custnome := aNomes[ Random( 9 ) ] + " " + aSobreNomes[ Random( 9 ) ] custsalario := aSalarios[ Random( 9 ) ] custdata := Date() ? custnome, custsalario, custdata cust:DbAppend() cust:Value("NOME") := custnome cust:Value("SALARIO") := custsalario cust:Value("data") := custdata Next cust:DbCommit() endIf ? "Existem ", Cust:Reccount, " clientes:" If cust:NetErr MsgStop("Cannot open xbapi.dbf") return .t. EndIf //cust:DbSetIndex( "cust_rd" ) // ' order by registration date for i = 1 to 5 // do While .Not. cust:EOF MsgStop( cust:value("nome") + " Salario: " + Str(cust:value("salario")) ) cust:DbSkip() next // enddo cust:DbCloseArea() // ' close table return .t. Se usou ou usa esta DLL/OCX Quais suas impressões? Onde encontro mais exemplos de uso? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 15, 2022 Report Share Posted May 15, 2022 Nao tenho certeza, mas acho que o caminho e por aqui: http://www.otc.pl/index.asp?s=81&l=2 Regards, saludos rochinha 1 Quote Link to comment Share on other sites More sharing options...
lucimauromelo Posted May 15, 2022 Report Share Posted May 15, 2022 Mediator eu uso, voce trabalha com os comando normais para dbf mais acessando o banco MYSQL , podendo também usar comando diretos no mysql. Existe a versão free para mysql que suporta ate 100 conexões e para outros bancos acho que 5 conexões ou comprar a versão paga. rochinha 1 Quote Link to comment Share on other sites More sharing options...
rochinha Posted May 16, 2022 Author Report Share Posted May 16, 2022 Amiguinhos, Valeu, vou dar uma olhada neste COM, pois gosto de usa automação, facilita demais as integrações. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.