Buenas compañeros , aqui os dejo este video de introduccion ala implementacion que lleva AMS de Mysqlite , usando una base de datos gratuita de [link]db4free.net[/link] y como proyecto... una agenda de contactos . espero que os sirva de mucha ayuda y cualquier cosa , ya sabéis... aquí andamos 


Code source del video:
On StartUp:
On Show de la pagina:
On Select del listBox:
On Click Boton "Nuevo":
On Click Boton "Guardar":



Code source del video:
On StartUp:
MySQL = luasql.mysql();
MySQLConnection, err = MySQL:connect('mysqldatabaseraf', 'rafaxplayer', 'amsspecialist', 'db4free.net', '3306');
if not MySQLConnection and err then
Dialog.Message("error",err);
else
Dialog.Message("Ok","conexion establecida");
end
MySQLCursor = MySQLConnection:execute("SELECT * From Agenda")
for i = 1, MySQLCursor:numrows() do
local ID,Nombre = MySQLCursor:fetch();
ListBox.AddItem("ListBox1", Nombre, ID);
end
ListBox.SelectItem("ListBox1", 1);
MySQLCursor:close()
new=false;
local nSel = ListBox.GetSelected("ListBox1")
if nSel then
nID = ListBox.GetItemData("ListBox1",nSel[1]);
MySQLCursor = MySQLConnection:execute("SELECT * From Agenda Where ID =".. nID .."")
local ID,Nombre,Apellidos,Email,Telefono = MySQLCursor:fetch();
Input.SetText("Nombre", Nombre)
Input.SetText("Apellidos", Apellidos)
Input.SetText("Email", Email)
Input.SetText("Telefono", Telefono)
MySQLCursor:close()
end
new=false;
Input.SetText("Apellidos","");
Input.SetText("Email", "");
Input.SetText("Nombre", "");
Input.SetText("Telefono", "");
new = true;
local Nombre = Input.GetText("Nombre");
local Apellidos = Input.GetText("Apellidos");
local Email = Input.GetText("Email");
local Telefono = Input.GetText("Telefono");
if Nombre ~= "" then
if new then
MySQLConnection:execute("INSERT INTO Agenda (ID, Nombre, Apellidos, Email, Telefono) VALUES (NULL, '"..Nombre.."', '"..Apellidos.."','"..Email.."', '"..Telefono.."')")
else
MySQLConnection:execute("UPDATE Agenda SET Nombre ='"..Nombre.."',Apellidos ='"..Apellidos.."',Email ='"..Email.."',Telefono ='"..Telefono.."' Where ID ="..nID)
end
end
ListBox.DeleteItem("ListBox1", LB_ALLITEMS);
MySQLCursor = MySQLConnection:execute("SELECT * From Agenda")
for i = 1, MySQLCursor:numrows() do
local ID,Nombre = MySQLCursor:fetch();
result = ListBox.AddItem("ListBox1", Nombre, ID);
end
MySQLCursor:close()