Error con sentencia Select

Hola a todos…

Agradecera me pudieran ayudar a corregir el error en el siguiente cdigo para consultar una base de datos. El cdigo fue adaptado (casi que copiado textualmente) del tutorial “Primeros pasos con SQLite en Xojo”:

db = new SQLiteDatabase

dim f as Folderitem = getfolderitem("").child(“Normas”).child(“KIT_NIIF.sqlite”)

db.DataBaseFile = f

if db.connect then

dim rc as RecordSet = db.SQLSelect("Select * from Catalogo)

if rc <> nil and rc.RecordCount > 0 then
  
  while not rc.EOF
    
    Listbox1.AddRow rc.Field(norma).StringValue
    
    rc.MoveNext
    
  Wend
  
end If

end If

La carpeta “Normas” est en el Escritorio y la base de datos “KIT_NIIF.sqlite” est en esta carpeta (Normas). Dentro de la Base de datos est la Tabla Catalogo y el campo que necesito consultar se denomina norma.

Sin embargo al probar el cdigo me arroja el siguiente error:

End quote missing
dim rc as RecordSet = db.SQLSelect("Select * from Catalogo)

Y de all en adelante, otros errores relacionados con “This item does not exist”.

Podran, por favor, ayudarme, a encontrar cual es el error que estoy cometiendo en la lnea dim rc as RecordSet = db.SQLSelect("Select * from Catalogo), ya que los dems errores creo que se corregiran al arreglar la sentencia anterior…

Muchas gracias por la ayuda que puedan prestarme pues soy completemente novaro en esto…

Csar A. Len Valds

Saludos, veo que la linea esta correcta, lo que debe asegurarse es que la tabla en concreto se llame asi Catalogo.

and check the value of DB.ERROR … always

Hola Darwin…

Efectivamente, la tabla se llama Catalogo, tal cual est escrito en la sentencia.

Tambin puse unas lineas (que despus quite) para probar la ejecucin. Algo parecido a esto:

If db.Error Then
MsgBox("Error: " + db.ErrorMessage)
Return
End If

Pero el error de la lnea dim rc as RecordSet = db.SQLSelect("Select * from Catalogo) sigue apareciendo…

hazlo asi

dim rc as RecordSet
rc = db.SQLSelect("Select * from Catalogo”)

para ir despejando…

Hola Darwin…

Cambi la linea segn tu sugerencia y ahora solo me arroja estos dos errores:

End quote missing
dim rc as RecordSet = db.SQLSelect("Select * from Catalogo)

This item does not exist
Listbox1.AddRow rc.Field(norma).StringValue

A veces pienso que puede ser la direccin de la base de datos dim f as Folderitem = getfolderitem("").child(“Normas”).child(“KIT_NIIF.sqlite”) aunque yo la prob y la reconoci bien. No s que pueda ser…

Hola a todos…

No s si sirva, pero la sentencia para la creacin de la tabla que, al parecer, est generando el problemas es:

CREATE TABLE “Catalogo” (“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , “norma” TEXT NOT NULL UNIQUE )

La Base de datos y las tablas que la componen las he hecho con la herramienta SQLite Manager de Firefox…

Gracias por la paciencia…

For the benefit of those of us that do not read or speak Spanish, it might be considerate and more helpful to post in both Spanish and English (Google Translate will get your point across)… This way more of us might be able to help

cambiar a: change to:

(“CREATE TABLE Catalogo (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , norma TEXT NOT NULL UNIQUE”)

La tabla es creada automticamente por la herramienta SQLite Manager y no puedo modificar la sentencia…
(The table is automatically created by SQLite Manager tool and can not modify the sentence …)

For friends who do not speak Spanish, my request for help is as follows (translation from Spanish to English with Google Translate):

I appreciate could help to correct the error in the following code to query a database. The code was adapted (almost verbatim copying) the tutorial “Getting Started with SQLite in Xojo”

db = new SQLiteDatabase

dim f as Folderitem = getfolderitem("").child(“Normas”).child(“KIT_NIIF.sqlite”)

db.DataBaseFile = f

if db.connect then

dim rc as RecordSet = db.SQLSelect("Select * from Catalogo)

if rc <> nil and rc.RecordCount > 0 then

while not rc.EOF

Listbox1.AddRow rc.Field(norma).StringValue

rc.MoveNext

Wend

end If

end If

The “Normas” folder on the desktop and database “KIT_NIIF.sqlite” is in this folder (Normas). Within the database is the Table Catalogo and the field need to see is called norma.

However when testing the code throws me the following error:

End quote missing
rc dim as RecordSet = db.SQLSelect (“Select * from Catalogo”)

And thereafter, other related errors “This item does not exist”.

Could you please help me find what the mistake I’m making on the line as RecordSet dim rc = db.SQLSelect (“Select * from Catalog”) because I think other errors be corrected to fix the sentence previous…

Thank you very much for the help they can lend as I am completemente novice at this and apologize for the bad English …

The quotation mark at the end of

dim rc as RecordSet = db.SQLSelect("Select * from Catalogo”)

Is not a standard quote. Replace it with the standard quote.

dim rc as RecordSet = db.SQLSelect(“Select * from Catalogo”)

Hi Wayne

Indeed, that was my mistake. Thank you very much for your help…

Glad I could help & your problem is solved. You could mark my answer as the solution so others don’t waste their time.

You’ve got some really good eyes Wayne!
Good catch!

@Albin Kiland Thanks!

The error message

[quote=252539:@Cesar Leon]End quote missing
dim rc as RecordSet = db.SQLSelect("Select * from Catalogo”)
[/quote]
was a bit of a clue, and frequently a new set of eye’s will pick up the obvious (which it is from the error message). I know it’s happened to me a number of times.