ASP login kódomban Microsoft OLE DB Provider hiba
A következő a problémám. Van egy ASP-s webprogram, ahol a beléptetésért felelős javascript login kód az alábbi:--------------
A következő sornál akad ki a script(82. sor)de csak, ha a megadott loginnel és passworddel első alkalommal akarok belépni. Későbbi próbálkozásnál már beenged.:
A visszakapott hibaüzenet a következő. Utánanéztem a hibakódnak a Microsoft oldalán, de az ott leírtak nem igen segítettek:
Microsoft OLE DB Provider for SQL Server error '80040e21'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/microsite/FocusST/game/login.asp, line 82
---------------
Utána néztem a dolognak, de sehol nem találtam megoldást a problémára. A szerver környezet információja a következő:
MDAC 2.70.9001.0
Microsoft.JScript, Version=7.0.3300.0 v1.1.4322
Windows Server 2000 + SQL Server 2000
Gondolom a kódban lehet a hiba, de nem tudok rájönni, hogy mi. Kérlek segítsetek, nagyon el vagyok veszve. Előre is köszönöm.
■ - <%@ Language="JavaScript"%>
- <!--#include file="connector.asp"-->
- <%
- function mkQuote(TheString){
- var re = /'/img;
- return(String(TheString).replace(re,"''"));
- }
- CAR = new Array("Z","A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z");
- CHIF = new Array("9","1","2","3","4","5","6","7","8","9");
- nowdate = new Date();
- if(!(Request.Form("pseudo")>"" && Request.Form("password")>"")){
- Response.Redirect("pseudo.asp?error=1");
- }else{
- if(!(parseInt(String(Request.Form("pseudo")).length)>=3 && parseInt(String(Request.Form("password")).length)>=3)){
- Response.Redirect("pseudo.asp?error=2");
- }else{
- rsTestPseudo = Server.CreateObject("ADODB.Recordset");
- rsTestPseudo.Open("SELECT id FROM Contacts WHERE pseudo = '"+mkQuote(Request.Form("pseudo"))+"';",connPage,3,3);
- if(!rsTestPseudo.EOF){
- rsTestPassword = Server.CreateObject("ADODB.Recordset");
- rsTestPassword.Open("SELECT id FROM Contacts WHERE id = "+rsTestPseudo.Fields("id")+" AND password = '"+mkQuote(Request.Form("password"))+"';",connPage,3,3);
- if(!rsTestPassword.EOF){
- //Ok, pseudo et mot de passe corrects: cration des codes.
- NUMCAR1 = parseInt(Math.random()*23)+1;
- NUMCAR2 = parseInt(Math.random()*23)+1;
- NUMCAR3 = parseInt(Math.random()*23)+1;
- NUMCAR4 = parseInt(Math.random()*23)+1;
- NUMCAR5 = parseInt(Math.random()*23)+1;
- NUMCAR6 = parseInt(Math.random()*23)+1;
- NUMCHIF1 = parseInt(Math.random()*8)+1;
- NUMCHIF2 = parseInt(Math.random()*8)+1;
- NUMCHIF3 = parseInt(Math.random()*8)+1;
- NUMCHIF4 = parseInt(Math.random()*8)+1;
- NUMCHIF5 = parseInt(Math.random()*8)+1;
- NUMCHIF6 = parseInt(Math.random()*8)+1;
- NUM1 = parseInt(Math.random()*1000)+1;
- NUM2 = parseInt(Math.random()*1000)+1;
- logincode = String(rsTestPassword.Fields("id")+"ID"+CAR[NUMCAR1]+nowdate.getMinutes()+CHIF[NUMCHIF1]+nowdate.getDate()+CHIF[NUMCHIF2]+nowdate.getHours()+CHIF[NUMCHIF3]+nowdate.getYear()+CAR[NUMCAR2]+nowdate.getMonth()+CAR[NUMCAR3]+nowdate.getDate()+"ST"+nowdate.getMilliseconds());
- gamecode = String(rsTestPassword.Fields("id")+"ID"+NUM1+CAR[NUMCAR4]+nowdate.getMinutes()+CHIF[NUMCHIF4]+nowdate.getDate()+CHIF[NUMCHIF5]+nowdate.getHours()+CHIF[NUMCHIF6]+nowdate.getYear()+CAR[NUMCAR5]+nowdate.getMonth()+CAR[NUMCAR6]+nowdate.getDate()+"FOCUS"+nowdate.getMilliseconds()+"ST"+NUM2);
- rsUPD = Server.CreateObject("ADODB.Recordset");
- rsUPD.Open("UPDATE Contacts SET logincode = '"+logincode+"' WHERE id = "+rsTestPassword.Fields("id")+";",connPage,3,3);
- rsADDScore = Server.CreateObject("ADODB.Recordset");
- rsADDScore.Open("INSERT INTO Scores (idcontact,gamecode) VALUES ("+rsTestPassword.Fields("id")+",'"+gamecode+"');",connPage,3,3);
- Session("logincode") = logincode;
- Session("gamecode") = gamecode;
- Response.Redirect("game.asp");
- }else{
- //Mauvais mot de passe ou pseudo dj utilis.
- Response.Redirect("pseudo.asp?error=3");
- }
- }else{
- //Nouveau participant.
- NUMCAR1 = parseInt(Math.random()*23)+1;
- NUMCAR2 = parseInt(Math.random()*23)+1;
- NUMCAR3 = parseInt(Math.random()*23)+1;
- NUMCAR4 = parseInt(Math.random()*23)+1;
- NUMCAR5 = parseInt(Math.random()*23)+1;
- NUMCAR6 = parseInt(Math.random()*23)+1;
- NUMCHIF1 = parseInt(Math.random()*8)+1;
- NUMCHIF2 = parseInt(Math.random()*8)+1;
- NUMCHIF3 = parseInt(Math.random()*8)+1;
- NUMCHIF4 = parseInt(Math.random()*8)+1;
- NUMCHIF5 = parseInt(Math.random()*8)+1;
- NUMCHIF6 = parseInt(Math.random()*8)+1;
- NUM1 = parseInt(Math.random()*1000)+1;
- NUM2 = parseInt(Math.random()*1000)+1;
- logincode = String(CAR[NUMCAR1]+nowdate.getMinutes()+CHIF[NUMCHIF1]+nowdate.getDate()+CHIF[NUMCHIF2]+nowdate.getHours()+CHIF[NUMCHIF3]+nowdate.getYear()+CAR[NUMCAR2]+nowdate.getMonth()+CAR[NUMCAR3]+nowdate.getDate()+"ST"+nowdate.getMilliseconds());
- gamecode = String(NUM1+CAR[NUMCAR4]+nowdate.getMinutes()+CHIF[NUMCHIF4]+nowdate.getDate()+CHIF[NUMCHIF5]+nowdate.getHours()+CHIF[NUMCHIF6]+nowdate.getYear()+CAR[NUMCAR5]+nowdate.getMonth()+CAR[NUMCAR6]+nowdate.getDate()+"FOCUS"+nowdate.getMilliseconds()+"ST"+NUM2);
- rsADD = Server.CreateObject("ADODB.Recordset");
- rsADD.Open("INSERT INTO Contacts (pseudo,password,logincode) VALUES ('"+mkQuote(Request.Form("pseudo"))+"','"+mkQuote(Request.Form("password"))+"','"+logincode+"');SELECT @@IDENTITY as ID;",connPage,3,3);
- rsID = rsADD.NextRecordset();
- rsADDScore = Server.CreateObject("ADODB.Recordset");
- rsADDScore.Open("INSERT INTO Scores (idcontact,gamecode) VALUES ("+rsID.Fields("ID")+",'"+gamecode+"');",connPage,3,3);
- Session("logincode") = logincode;
- Session("gamecode") = gamecode;
- Response.Redirect("game.asp");
- }
- }
- }
- Response.Redirect("pseudo.asp");
A következő sornál akad ki a script(82. sor)de csak, ha a megadott loginnel és passworddel első alkalommal akarok belépni. Későbbi próbálkozásnál már beenged.:
- rsID = rsADD.NextRecordset();
A visszakapott hibaüzenet a következő. Utánanéztem a hibakódnak a Microsoft oldalán, de az ott leírtak nem igen segítettek:
Microsoft OLE DB Provider for SQL Server error '80040e21'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/microsite/FocusST/game/login.asp, line 82
---------------
Utána néztem a dolognak, de sehol nem találtam megoldást a problémára. A szerver környezet információja a következő:
MDAC 2.70.9001.0
Microsoft.JScript, Version=7.0.3300.0 v1.1.4322
Windows Server 2000 + SQL Server 2000
Gondolom a kódban lehet a hiba, de nem tudok rájönni, hogy mi. Kérlek segítsetek, nagyon el vagyok veszve. Előre is köszönöm.
1 lehetőség
Itt egy megoldás az ügyre:
http://support.microsoft.com/kb/269495
Ez MDAC 2.7-esre igaz lehet. Az én esetemben 2.8-as az MDAC, nem javascript, nem web, de ugyanaz a hiba. Ám a fenti dolog teljesen rendben van. Így kereshetek tovább...
Minden jót!
András