ASP + FLASH + ACCESS图文说明教程_ASP图文说明教程
发表时间:2023-08-13 来源:明辉站整理相关软件相关文章人气:
[摘要]ASP部分:<%added=request("added")del=request("del")action=request.QueryString(&...
ASP部分:
<%
added=request("added")
del=request("del")
action=request.QueryString("action")
set conn=server.createObject ("adodb.connection")
set rs=server.createObject ("adodb.recordset")
dbpath=server.MapPath ("db1.mdb")
connstr="Driver={Microsoft Access Driver (*.mdb)};dbq="&dbpath
conn.Open connstr
if (action <> "add" and action <>"added") then
'下面是读取数据库信息部分
sql="select * from shu where id=1"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
else
Response.Write "a=" & (RS("number"))
response.Write "&eof=true"
end if
end if
%>
<%
'下面部分为删除按扭信息部分
if (action="add") then
sql="select * from shu where id=1"
rs.Open sql,conn,1,3
rs("number")=del
rs.update
response.write "ok=1"
rs.close
end if
%>
<%
'下面的部分是保存按扭信息部分
if (action="added") then
sql="select * from shu where id=1"
rs.Open sql,conn,1,3
rs("number")=added
rs.update
response.write "save=1"
rs.close
end if
%>
FLASH部分:
第一部分是初始化变量:
eof = "false";
a=0; //按扭的初始数量
r = random(65500);
loadVariables("read.asp?action=" add r, "");//添加随机数的目的是防止不同浏览器不无法刷新变量的(不过可能是画蛇添足,哈哈)第9贞:
if (eof ne "true") {
gotoAndPlay("read");
}
判断是否读取数据成功!
第十贞:
a = Number(a);
if (a == 0 or a<0) {
a = 1;
for (i=1; i<=a; i++) {
_root.attachMovie("m"+i, "m"+i, i+1);
if (i<=5) {
eval("m"+i)._x = 200+i*eval("m"+i)._width;
eval("m"+i)._y = 200;
}
if (i>5 and i<=10) {
eval("m"+i)._x = i*eval("m"+i)._width-50;
eval("m"+i)._y = 250;
}
}
} else {
for (i=1; i<=a; i++) {
_root.attachMovie("m"+i, "m"+i, i+1);
if (i<=5) {
eval("m"+i)._x = 200+i*eval("m"+i)._width;
eval("m"+i)._y = 200;
}
if (i>5 and i<=10) {
eval("m"+i)._x = i*eval("m"+i)._width-50;
eval("m"+i)._y = 250;
}
}
}
stop();
//根据数据库中按扭数量"a"的大小添加按扭,并且以5*2的顺序进行排序!加载按扭:
on (release) {
if (a<=10 and a>=1) {
a =Number(a)+1;
trace(a);
_root.attachMovie("m"+a, "m"+a, a+1);
if (a<=5) {
eval("m"+a)._x = 200+a*eval("m"+a)._width;
eval("m"+a)._y = 200;
}
if (a>5 and a<=10) {
eval("m"+a)._x = a*eval("m"+a)._width-50;
eval("m"+a)._y = 250;
}
}
if (a>10) {
_root.aa.attachMovie("wrong", "wrong", 1000);
this.wrong._width = 600;
this.wrong._height = 400;
this.wrong._x = 225;
this.wrong._y = 200;
a=10
}
}
根据A的数量进行在次加载按扭(这里只采用FLASH内部加载),如果超按扭数量超过10个,则停止加载并出现警告!删除按扭部分:
on (release) {
del = a-1;
loadVariables("read.asp?action=add", "", "POST");
for(i=1;i<=a;i++){
removeMovieClip(eval("m"+i));
}
gotoAndPlay("do_del");
}
//确定删除后A的值,并将其传送个ASP!但是此处需要清理FLASH内部A的数量,以防止FLASH内部没有刷新而造成删除后A的数量减少,但按牛数量没有减少的情况!保存按扭部分:
on (release) {
added = a;
for(i=1;i<=a;i++){
removeMovieClip(eval("m"+i));
}
loadVariables("read.asp?action=added", "", "POST");
gotoAndPlay("do_save");
}//将A的数值传给ASP 然后存到数据库中,此处也清空了FLASH内部A的值,原因同上!
Microsoft Access在很多地方得到广泛使用,例如小型企业,大公司的部门。