Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Javascript中的一个Open()记录集函数中使用多个查询_Javascript_Html_Oracle_Connection String_Recordset - Fatal编程技术网

在Javascript中的一个Open()记录集函数中使用多个查询

在Javascript中的一个Open()记录集函数中使用多个查询,javascript,html,oracle,connection-string,recordset,Javascript,Html,Oracle,Connection String,Recordset,我目前正在使用Javascript连接到我的数据库(我知道这不是最好的方式,但这就是我的方式,我无法改变它) 这就是我正在做的: function changeCode(textfield1, textfield2, textfield3){ if(emptyFields(textfield1, textfield1, textfield1) == false){ var connection = new ActiveXObject("ADODB.Connection") ; var conn

我目前正在使用Javascript连接到我的数据库(我知道这不是最好的方式,但这就是我的方式,我无法改变它)

这就是我正在做的:

function changeCode(textfield1, textfield2, textfield3){

if(emptyFields(textfield1, textfield1, textfield1) == false){
var connection = new ActiveXObject("ADODB.Connection") ;
var connectionstring = "DSN=dsn_prod;UID=usuid;PWD=usuid";

connection.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");

var code= new String();
var client= new String();
var post= new String();
code= document.getElementById(textfield1).value;
client = document.getElementById(textfield2).value;
post= document.getElementById(textfield3).value;    

var r=confirm("Are you sure you wish to change code?");
if(r==true){
    rs.Open("update agen set c_it ="+code+" where n_client = "+client+" and c_post_client='"+post+"'",connection);
    rs.close;
    rs.Open("update clie set c_it="+code+" where n_client = "+client+" and c_post_client='"+post+"'",connection);
    rs.close;
    rs.Open("update ncli set c_it="+code+" where n_client= "+client+" and c_post_client='"+post+"'",connection);
    rs.close;
    rs.Open("update foli set c_it="+code+" where c_it <> "+code+" and n_client = "+client+" and c_post_client='"+post+"'",connection);
    rs.close;
    connection.close;
    }


}
功能更改代码(textfield1、textfield2、textfield3){
if(emptyFields(textfield1,textfield1,textfield1)==false){
var connection=newactivexobject(“ADODB.connection”);
var connectionstring=“DSN=DSN\u prod;UID=usuid;PWD=usuid”;
连接。打开(连接字符串);
var rs=新的ActiveXObject(“ADODB.Recordset”);
var代码=新字符串();
var client=新字符串();
var post=新字符串();
代码=document.getElementById(textfield1).value;
client=document.getElementById(textfield2).value;
post=document.getElementById(textfield3).value;
var r=确认(“您确定要更改代码吗?”);
如果(r==true){
rs.Open(“更新代理集c_it=“+code+”,其中n_client=“+client+”和c_post_client=”“+post+”,连接);
rs.close;
rs.Open(“更新clie set c_it=“+code+”,其中n_client=“+client+”和c_post_client=”“+post+”,连接);
rs.close;
rs.Open(“更新ncli set c_it=“+code+”,其中n_client=“+client+”和c_post_client=”“+post+”,连接);
rs.close;
rs.Open(“更新对开本设置c_it=“+code+”,其中c_it“+code+”和n_client=“+client+”和c_post_client=”“+post+””,连接);
rs.close;
连接。关闭;
}
}
}

有没有一种方法可以将所有这些都变成一个大查询,而不是多次打开和关闭记录集


谢谢

经过一番思考,我意识到这真的很简单。最好的方法是使用
BEGIN
END
语句一起运行一系列查询:

rs.Open("BEGIN update agen set c_it ="+code+" where n_client = "+client+" and c_post_client='"+post+"'; update clie set c_it="+code+" where n_client = "+client+" and c_post_client='"+post+"'; update ncli set c_it="+code+" where n_client= "+client+" and c_post_client='"+post+"'; update foli set c_it="+code+" where c_it <> "+code+" and n_client = "+client+" and c_post_client='"+post+"';END;",connection);
rs.Open(“开始更新代理集c_it=“+code+”,其中n_client=“+client+”和c_post_client=”“+post+”;更新clie set c_it=“+code+”,其中n_client=“+client+”和c_post_client=”“+post+”;更新ncli set c_it=“+code+”其中n_client=“+client+”和c_post_client=“+post+”;更新foli set c_it=“+code+”,其中c_it=“+code+”+code+”+“和n_client=“+client+”和c_post_client=”“+post+”;END;”,连接);
希望这对任何人都有帮助