ugrás a tartalomhoz

ASP login kódomban Microsoft OLE DB Provider hiba

rőt pajesz · 2006. Már. 24. (P), 13.15
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:
  1. <%@ Language="JavaScript"%>  
  2. <!--#include file="connector.asp"-->  
  3. <%  
  4.   
  5. function mkQuote(TheString){  
  6.     var re = /'/img;  
  7.     return(String(TheString).replace(re,"''"));  
  8. }  
  9.   
  10. 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");  
  11. CHIF = new Array("9","1","2","3","4","5","6","7","8","9");  
  12. nowdate = new Date();  
  13.   
  14. if(!(Request.Form("pseudo")>"" && Request.Form("password")>"")){  
  15.     Response.Redirect("pseudo.asp?error=1");  
  16. }else{  
  17.     if(!(parseInt(String(Request.Form("pseudo")).length)>=3 && parseInt(String(Request.Form("password")).length)>=3)){  
  18.         Response.Redirect("pseudo.asp?error=2");  
  19.     }else{  
  20.         rsTestPseudo = Server.CreateObject("ADODB.Recordset");  
  21.         rsTestPseudo.Open("SELECT id FROM Contacts WHERE pseudo = '"+mkQuote(Request.Form("pseudo"))+"';",connPage,3,3);  
  22.         if(!rsTestPseudo.EOF){  
  23.             rsTestPassword = Server.CreateObject("ADODB.Recordset");  
  24.             rsTestPassword.Open("SELECT id FROM Contacts WHERE id = "+rsTestPseudo.Fields("id")+" AND password = '"+mkQuote(Request.Form("password"))+"';",connPage,3,3);  
  25.             if(!rsTestPassword.EOF){  
  26.                 //Ok, pseudo et mot de passe corrects: cration des codes.  
  27.                 NUMCAR1 = parseInt(Math.random()*23)+1;  
  28.                 NUMCAR2 = parseInt(Math.random()*23)+1;  
  29.                 NUMCAR3 = parseInt(Math.random()*23)+1;  
  30.                 NUMCAR4 = parseInt(Math.random()*23)+1;  
  31.                 NUMCAR5 = parseInt(Math.random()*23)+1;  
  32.                 NUMCAR6 = parseInt(Math.random()*23)+1;  
  33.                 NUMCHIF1 = parseInt(Math.random()*8)+1;  
  34.                 NUMCHIF2 = parseInt(Math.random()*8)+1;  
  35.                 NUMCHIF3 = parseInt(Math.random()*8)+1;  
  36.                 NUMCHIF4 = parseInt(Math.random()*8)+1;  
  37.                 NUMCHIF5 = parseInt(Math.random()*8)+1;  
  38.                 NUMCHIF6 = parseInt(Math.random()*8)+1;  
  39.                 NUM1 = parseInt(Math.random()*1000)+1;  
  40.                 NUM2 = parseInt(Math.random()*1000)+1;  
  41.                   
  42.                 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());  
  43.                 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);  
  44.                   
  45.                 rsUPD = Server.CreateObject("ADODB.Recordset");  
  46.                 rsUPD.Open("UPDATE Contacts SET logincode = '"+logincode+"' WHERE id = "+rsTestPassword.Fields("id")+";",connPage,3,3);  
  47.                   
  48.                 rsADDScore = Server.CreateObject("ADODB.Recordset");  
  49.                 rsADDScore.Open("INSERT INTO Scores (idcontact,gamecode) VALUES ("+rsTestPassword.Fields("id")+",'"+gamecode+"');",connPage,3,3);  
  50.                   
  51.                 Session("logincode") = logincode;  
  52.                 Session("gamecode") = gamecode;  
  53.                   
  54.                 Response.Redirect("game.asp");  
  55.               
  56.             }else{  
  57.                 //Mauvais mot de passe ou pseudo dj utilis.  
  58.                 Response.Redirect("pseudo.asp?error=3");  
  59.             }  
  60.         }else{  
  61.             //Nouveau participant.  
  62.             NUMCAR1 = parseInt(Math.random()*23)+1;  
  63.             NUMCAR2 = parseInt(Math.random()*23)+1;  
  64.             NUMCAR3 = parseInt(Math.random()*23)+1;  
  65.             NUMCAR4 = parseInt(Math.random()*23)+1;  
  66.             NUMCAR5 = parseInt(Math.random()*23)+1;  
  67.             NUMCAR6 = parseInt(Math.random()*23)+1;  
  68.             NUMCHIF1 = parseInt(Math.random()*8)+1;  
  69.             NUMCHIF2 = parseInt(Math.random()*8)+1;  
  70.             NUMCHIF3 = parseInt(Math.random()*8)+1;  
  71.             NUMCHIF4 = parseInt(Math.random()*8)+1;  
  72.             NUMCHIF5 = parseInt(Math.random()*8)+1;  
  73.             NUMCHIF6 = parseInt(Math.random()*8)+1;  
  74.             NUM1 = parseInt(Math.random()*1000)+1;  
  75.             NUM2 = parseInt(Math.random()*1000)+1;  
  76.               
  77.             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());  
  78.             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);  
  79.               
  80.             rsADD = Server.CreateObject("ADODB.Recordset");  
  81.             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);  
  82.             rsID = rsADD.NextRecordset();  
  83.               
  84.             rsADDScore = Server.CreateObject("ADODB.Recordset");  
  85.             rsADDScore.Open("INSERT INTO Scores (idcontact,gamecode) VALUES ("+rsID.Fields("ID")+",'"+gamecode+"');",connPage,3,3);  
  86.               
  87.             Session("logincode") = logincode;  
  88.             Session("gamecode") = gamecode;  
  89.               
  90.             Response.Redirect("game.asp");  
  91.         }  
  92.     }  
  93. }  
  94.   
  95. 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.:
  1. 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

1 lehetőség

Anonymous · 2006. Dec. 8. (P), 12.01
Gondolom már nem aktuális az eltelt idő miatt, de én is hasonló problémával küzdök, de más környezetben, így találtam erre a lapra.

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