import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=551;bottom=311;)
winform.add(
button={cls="button";text="写";left=392;top=16;right=536;bottom=80;z=2;};
button2={cls="button";text="读";left=392;top=232;right=536;bottom=296;z=3;};
plus={cls="plus";left=16;top=16;right=376;bottom=296;bgcolor=8388736;z=1;};
static={cls="static";left=400;top=136;right=536;bottom=168;transparent=1;z=4;};
static2={cls="static";left=400;top=168;right=536;bottom=200;transparent=1;z=5;};
)
/*}}*/
winform.show();
import godking.conn
var conn = godking.conn.openAccess( "/test.accdb", )
winform.button.oncommand = function(id,event){
var rs = conn.rs("select * from [tb]");
rs.setValue("nam","张三");
rs.setValue("age",18);
rs.setValue("photo",..raw.buffer(..string.load("/angry-birds.png")));
rs.UpDate();
rs.close();
winform.button2.oncommand();
}
/*
两种直接用sql语句更改记录数据的方法:
conn.exec( "update [tb] set nam=?,age=?,photo=? where id=2",
{"张三", 18, ..raw.buffer(..string.load("/pic.png"))}
);
conn.exec( "update [tb] set nam=@nam,age=@age,photo=@photo where id=2",
{
nam = "张三三",
age=188,
photo=..raw.buffer(..string.load("E:\图片素材\png\png256_数字、字母\dayanjing_zimu_z.png"))
}
);
*/
winform.button2.oncommand = function(id,event){
var t = conn.getTable( "select * from [tb]",false,0,0 );
winform.static.text = t[1]["nam"]
winform.static2.text = t[1]["age"]
winform.plus.foreground = t[1]["photo"];
}
win.loopMessage();