永发信息网

ASP写入数据库权限问题

答案:3  悬赏:60  手机版
解决时间 2021-05-02 01:39
  • 提问者网友:杀生予夺
  • 2021-05-01 06:19

问题:可以正常读取数据库内数据表的内容,也可以正常删除数据库内数据表内容,

但是不能写入数据。这是什么回事

我用的数据库是Access ASP语言是JAVASCRIPT

还有FLASH CS3

这是做好后FLASH发布成HTML的效果图

这是FLASH代码;

System.useCodepage=true;
var xuanxiang = "显示";

var xianshi_lv=new LoadVars();
var shanchu_lv=new LoadVars();
var tianjia_lv=new LoadVars();
xianshi();
//定义按钮关联函数
shanchu_btn.onRelease=function(){
shanchu();
}
tianjia_btn.onRelease=function(){
tianjia();
}

//各函数内容

function xianshi(){
xuanxiang="显示";
xianshi_lv.xuanxiang_flash=xuanxiang;
xianshi_lv.sendAndLoad("caozuo.asp?bianliang="+random(999),xianshi_lv,"post");
xianshi_lv.onLoad =function(chenggong){
if(chenggong){
zongtiaoshu_txt.text=xianshi_lv.zongtiaoshu;
xiangxixinxi_txt.htmlText=xianshi_lv.xiangxixinxi;
}else{xiangxixinxi_txt.text="加载失败"}
}
}

function shanchu(){
xuanxiang="删除";
shanchu_lv.xuanxiang_flash=xuanxiang;
shanchu_lv.xuhao_flash=shanchuxuhao_txt.text;
shanchu_lv.sendAndLoad("caozuo.asp?bianliang="+random(9999),shanchu_lv,"post");
shanchu_lv.onLoad=function(){
if(shanchu_lv.shanchu_fanhui=="成功"){
shanchuxuhao_txt.text=="删除成功";
xianshi();
}else{shanchuxuhao_txt.text="删除失败";
}
}
}


function tianjia(){
xuanxiang="添加";
tianjia_lv.xuanxiang_flash=xuanxiang;
tianjia_lv.tianjiaxingming_flash=tianjiaxingming_txt.text;
tianjia_lv.tianjiayuwen_flash=tianjiayuwen_txt.text;
tianjia_lv.tianjiashuxue_flash=tianjiashuxue_txt.text;
tianjia_lv.sendAndLoad("caozuo.asp?bianliang="+random(999),tianjia_lv,"post");
tianjia_lv.onLoad=function(){
if(tianjia_lv.tianjia_fanhui=="成功"){
tianjiaxingming_txt.text="添加成功"
xianshi();
}else{tianjiaxingming_txt.text="添加失败";
}
}
}

这是ASP代码

<%@LANGUAGE="JAVASCRIPT"%>
<%
lianjie=Server.CreateObject("ADODB.Connection");
lianjie.Open("driver={Microsoft Access Driver (*.mdb)};dbq="+Server.MapPath("shujuku.mdb"));
rs=Server.CreateObject("ADODB.Recordset");
var xuanxiang=Request("xuanxiang_flash");
%>

<%
if(xuanxiang=="显示"){
xianshi();
}else if(xuanxiang=="删除"){
shanchu();
}else if(xuanxiang=="添加"){
tianjia();
}
%>


<%
function xianshi(){
sql="select *from shujubiao";
rs.Open(sql,lianjie,3);
var zongtiaoshu=rs.RecordCount;
var meiyejilu=20;
shuchuneirong="";
for(i=0;i<meiyejilu;i++){
if(!rs.EOF){
var xuhao_asp=rs("xuhao");
var xingming_asp=rs("xingming");
var yuwen_asp=rs("yuwen");
var shuxue_asp=rs("shuxue");
shuchuneirong=shuchuneirong+"<br>序号|"+xuhao_asp+"姓名"+xingming_asp+"语文"+yuwen_asp+"数学"+shuxue_asp;
rs.MoveNext();
}
}
Response.Write("&zongtiaoshu="+zongtiaoshu+"&");
Response.Write("&xiangxixinxi="+shuchuneirong+"&");
}
%>

<%
function shanchu(){
var id=Request("xuhao_flash");
sql="delete from shujubiao where xuhao="+id;
rs.Open(sql,lianjie,3);
Response.Write("<br>&shanchu_fanhui=成功"+"&");
}
%>

<%
function tianjia(){
var tianjiaxingming=Request("tianjiaxingming_flash");
var tianjiayuwen=Request("tianjiayuwen_flash");
var tianjiashuxue=Request("tianjiashuxue_flash");
sql="insert into shujubiao (xingming,yuwen,shuxue) values ("+tianjiaxingming+","+tianjiayuwen+","+tianjiashuxue+")";
rs.Open(sql,lianjie,3);
Response.Write("&tianjia_fanhui=成功");
}
%>

这是Access界面

最佳答案
  • 五星知识达人网友:猎心人
  • 2021-05-01 06:29
sql="insert into shujubiao (xingming,yuwen,shuxue) values (‘"+tianjiaxingming+"’,‘"+tianjiayuwen+"’,‘"+tianjiashuxue+"’)";
全部回答
  • 1楼网友:妄饮晩冬酒
  • 2021-05-01 07:12
iss权限设置有问题
  • 2楼网友:白昼之月
  • 2021-05-01 06:42
这个数据库应该没问题。问题出在你的目录权限不够。存数据库那个目录要可写才行。不然无法写入数据库的。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯