Get database fields

Advanced programming using WinTask scripting language

Get database fields

Postby Hugo Baron on Wed Feb 11, 2015 2:47 pm

Hi!.
First one, soory for my bad english. I'm connecting to oracle database: it's successfull. But when i try to get the fields via dbGetFielNumber and dbGetFieldString, the program send me a message in spanish: "Error at line xxx. Nombre de campo o de índice incorrecto.". Here is the code:

ret = DbConnect("DSN=pruebaSIFI; UID=vu_sfi; PWD=vu_sfi")
if ret <> 0 then
msgbox("No fue posible conectarse a la base de datos")
stop
else
DbSelect("select cias_cias, cias_descri from ge_tcias where cias_cias in (110004,110005)",DYNASET)
num_registros = DbRecordCount()
if num_registros = 0 then
msgbox("No hay registros para seleccionar")
else
msgbox("Se seleccionaron "+str$(num_registros)+" registros")
While not DbEof()
DbGetFieldNumeric("cias_cias", empresa)
DbGetFieldString("cias_descri", nombre$)
msgbox("Empresa = "+str$(empresa)+" - "+nombre$)
DbMoveNext()
Wend
dbClose()
dbDisconnect()
endif
endif


How can fix it? Thanks a lot for your help.
Hugo Baron
 
Posts: 2
Joined: Wed Feb 11, 2015 2:31 pm

Re: Get database fields

Postby TechSupport on Thu Feb 12, 2015 9:19 am

Hello,
This error message is sent by SQL, I don't speak Spanish, I've searched on google for this error message and there are some explanations in Spanish too. Google the error message and it should tell what is the error.
Regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am

Re: Get database fields

Postby Hugo Baron on Thu Feb 12, 2015 2:23 pm

Hello.
Thanks for your reply. I fixed the problem: fields name must be in capital letter, and the "cias_cias" numeric field in database, must be convert to varchar using "cast" in the select sentence, because dbGetFieldNumeric cant not recognize CIAS_CIAS as a numeric field:

SELECT CAST(CIAS_CIAS as VARCHAR(10)) as EMPRESA, CIAS_DESCRI FROM GE_TCIAS WHERE CIAS_CIAS IN (110004,110005)

Thanks again and Regards.
Hugo Baron
 
Posts: 2
Joined: Wed Feb 11, 2015 2:31 pm


Return to Scripts programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron