Consultar una tabla

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
Buen Dia Colegas:
Mi consulta es la siguiente yo solo quiero consultar una tabla, pero no se como corregir este script para que al momento que haga la consulta solo me aparezca una tabla??

Si alguien me ayuda por favor,

Gracias

A que script te refieres mi buen?

Posteate tu codigo a ver que se puede hacer, aqui andamos un rato.

Saludos.

Perdon aqui esta colega:
if e_Row > 0 then
	local sCurrentTable = Grid.GetCellText("grdTables", e_Row, e_Column)
	local tblReturn = SQLite.QueryToTable(dbHandle, "Select sql from sqlite_master where tbl_name = '"..sCurrentTable.."'");
	if tblReturn.Rows > 0 then
		Grid.ExpandToFit("grdQueryResult", false, true)
		--find the primary key name if there is one
		nPos = String.Find(tblReturn.Data[1]["sql"], "integer primary key", 1, false);
		if nPos > -1 then
			nBracket=String.ReverseFind(String.Left(tblReturn.Data[1]["sql"], nPos - 1), "(")
			nComma=String.ReverseFind(String.Left(tblReturn.Data[1]["sql"], nPos - 1), ",")
			if nComma > -1 then
				if nComma > nBracket then
					sPrimaryKey = String.Mid(String.Left(tblReturn.Data[1]["sql"], nPos - 1), nComma + 1, -1)		
				else
					sPrimaryKey = String.Mid(String.Left(tblReturn.Data[1]["sql"], nPos - 1), nBracket + 1, -1)		
				end
			elseif nBracket > -1 then
				if nBracket > nComma then
					sPrimaryKey = String.TrimLeft(String.TrimRight(String.Mid(String.Left(tblReturn.Data[1]["sql"], nPos - 1), nBracket + 1, -1)," ")," ")		
				else
					sPrimaryKey = String.TrimLeft(String.TrimRight(String.Mid(String.Left(tblReturn.Data[1]["sql"], nPos - 1), nComma + 1, -1)," ")," ")
				end
			end
		else
			sPrimaryKey = ""
		end
	
		-- Clear e_Columns
		Grid.DeleteAllItems("grdQueryResult");

		--add e_RowID to the select 
		nCursor = SetCursor(32514)
		BindGrid(dbHandle, "grdQueryResult", "Select RowID, * from "..sCurrentTable);
		ReturnCursor(nCursor)
		Grid.AutoSizeColumns("grdQueryResult", GVS_BOTH, true)
		Grid.SetGridLines("grdQueryResult", true, true)
	end
end

Mira viejo, me recordaste uno de mis "pininos" en todo esto, revisate el contenido de este enlace a ver si algo te sirve:

Padlock Master, Gestor basico de Contraseñas, manejo de Grid y bases de Datos SQLite

Espero lo encuentres util.

Saludos ;)

lo que buscas es esto:

Cargar DB a un Grid Por Douglas A. Castillo.apz 304 KB
HIDE: ON
Hidebb Message Hidden Description

Asi lo hago yo
local query = "SELECT * FROM TABLA1"
Items = {}; -- Aqui quedaran los elementos de la tabla una vez consultadosm accedes a ellos asi Items[1] Items[3] etc...
num = 0;
	for row in db:nrows(query) do
		num = num+1
		data = {numero = row.numero, etiqueta=row.etiqueta, sitioweb=row.sitioweb}
		Items[num] = data
		Application.Sleep(1)
	end

Thanks

Agotaras:
Copie tu misma script del boton cargar base de datos:
db = SQLite.Open(_SourceFolder.."\\Autoplay\\Docs\\Sistema.db");
if e_Row ~= 1 then
sCurrentTable = Grid.GetCellText("Grid1", e_Row, e_Column)
local tblReturn = SQLite.QueryToTable(db, "SELECT RecordID, * FROM Productos");
if tblReturn.Rows > 0 then

for x = 1 , tblReturn.Rows do
Grid.SetCellText("Grid1", x, 1, tblReturn.Data[x]["RecordID"], true);
end

Grid.ExpandToFit("Grid1", false, true)
-- Borrar e_Columns
Grid.SetColumnCount("Grid1", 0);
Grid.SetRowCount("Grid1", 0);
Grid.Refresh("Grid1")


--añadir e_RowID a la selección
BindGrid(db, "Grid1", "SELECT RecordID, * FROM Productos");
--ReturnCursor(nCursor)
Grid.AutoSizeColumns("Grid1", GVS_BOTH, true)
Grid.SetGridLines("Grid1", true, true)
Grid.SetGridLines("Grid1", GVL_BOTH);
end
end

Pero cuando le doy cargar me sale este error:
[img]Bibliotecas\Imágenes[/img]

Este es el mensaje de error:
Error:attemp to index local 'tblReturn'(a nil value)
Stack Traceback:
1:[Reportes -> xButton -> On Click]Line:5 in main chunk

1 - Usa el tag LUA para postear código que para eso esta.

2- Ese error es porque la consulta no retorna nada y hay algún error , a mi no me cuadra eso de RecordID,* que sentido tiene seleccionar un campo y todos a la vez.

Creo que debería ser así "SELECT RecordID FROM Productos".

thanks

interesante

ok gracias
veamos
Provando
Grazie
oir

En regardant , je vais encore apprendre , merci