1 messaggio dal 16 giugno 2004
Ciao a tutti,
sono un novellino di ASP e vi volevo chiedere aiuto.Ho progettato una animazione in flash dove sono presenti due campi: uno di log-in e uno per la password. Tramite Actionscript riesco a passare le variabili User_id e User_psw alla pagina login.asp, che dovrebbe verificare se i dati immessi sono presenti nel database (dblogin.mdb) ma la pagina asp non mi risponde e mi da un errore in visualizzazione su Explorer che recita così:

Microsoft VBScript runtime error '800a01a8'

Object required: 'MErs'

/inforeas_def/loginftp.asp, line 19


Se il log-in è giusto dovrebbe portarmi su un url esterno, in caso contrario dovrebbe apparirmi una pagina o messaggio di errore. Vi posto la pagina, qualcuno può aiutarmi?Visto che non ne esco fuori da 3 giorni
Ve ne sarei immensamente grato

<%

'Connects to database using recordset method
Function dataConn(database,connection,recordset)
Set connection = Server.CreateObject("ADODB.Connection")
Set recordset = Server.CreateObject("ADODB.Recordset")
'connection.Open "DBQ=" & Server.Mappath(database) & ";Driver={Microsoft Access Driver (*.mdb)};"
'connection.Open "Provider=Microsoft.jet.OLEDB.4.0;Data Source= " & Request.ServerVariables("APPL_PHYSICAL_PATH") & "admin/dbLogin.mdb"
connection.Open "Provider=Microsoft.jet.OLEDB.4.0;Data Source= " & Request.ServerVariables("APPL_PHYSICAL_PATH") & database
End Function

'If user has attempted to log in then do the following
'If Request.QueryString("login") = "true" Then

'Calls dataConn function to open dbLogin.mdb
' dataConn "../../../admin/dbLogin.mdb",LOdc,MErs

'Selects all fields within tblMembers where username and password match those entered by the user
MErs.Open "SELECT * FROM tblMembers WHERE Username='" & Request.querystring("User_id") & "' AND Password = '" & Request.querystring("User_pwd") & "'", LOdc

'If no records were found then reload page with an error

If MErs.EOF = true Then
'Response.Redirect "login.asp?error=mismatch"
Response.write "loginftp=no"
else
response.write "loginftp=ok"
response.Write(Request.ServerVariables("APPL_PHYSICAL_PATH"))
'Set cookie to store user details


Response.Cookies("User_ID") = MErs("User_ID")
Response.Cookies("User_ID").Path = "/"
Response.Cookies("Username") = MErs("Username")
Response.Cookies("Username").Path = "/"
Response.Cookies("Password") = MErs("Password")
Response.Cookies("Password").Path = "/"


'Close database connection
MErs.Close
LOdc.Close
Set LOdc = nothing
Response.Redirect "ftp://riccardo:piddina@ftp.inforeas.it"
End If
%>

<html>
<head>
css" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--



function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000" alink="#000000" topmargin="2" onLoad="MM_preloadImages('file:///G|/goldpoint/images/S_Info2Cel.gif','file:///G|/goldpoint/images/S_prodottiCel.gif','file:///G|/goldpoint/images/S_formazioneCel.gif','file:///G|/goldpoint/images/S_AssistenzaCel.gif','file:///G|/goldpoint/images/S_profiloCel.gif','file:///G|/goldpoint/images/S_ServiziCel.gif','file:///G|/goldpoint/images/S_malingCel.gif')">
<div align="center">

</div>

<br>
<table width="74%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><p> </p>

</td>
<td width="0%" rowspan="7" background="file:///G|/goldpoint/images/lineS.GIF"> </td>
<td width="58%" rowspan="7" class="black10"> <FORM name="login" method=post action="file:///G|/./login.asp?login=true">
<TABLE width="176" align=center cellpadding=5 cellspacing=2>
<%
'If an error was passed to the page then display an error message
If Request.QueryString("error") = "mismatch" Then
Response.Write "<TR align=center>"
Response.Write "<TD bgcolor=#FF0000 colspan=2>"
Response.Write" <b><P class=TestoNormal10; color: #FFFF00"">Dati non corretti. Ripetere il Login!!!</P></B>"
End If
%>
<TR align=center>
<TD colspan=2>
<P style="font: 12pt Arial"> </P>
<TR align=center>

<TD width="83" class="black10"> <strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><em>Username:</em></font>
</strong>
<TD width="153" class="TestoNormal10">
<div align="left">

<input type=text size=10 name="username" class="black10">
</div><TR align=center>

<TD class="black10"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><em>Password:</em></font>
</strong>
<TD style="font:12pt Arial">
<div align="left">

<input name="password" type=password class="black10" size=10>
</div>
<TR align=center>
<TD colspan="2">
<input name="submit" type=submit class="black10" value="Entra ">

</TABLE>
<p> </p></FORM></p>
</td>
<td width="0%" rowspan="7" background="file:///G|/goldpoint/images/lineS.GIF"> </td>
<td width="25%" rowspan="7" valign="top" bgcolor="#ffffFF"><div align="center">
</div></td>
</tr>
</table>
</body>
</html>

358 messaggi dal 11 luglio 2003
tutto questo cancellalo:
'Connects to database using recordset method
Function dataConn(database,connection,recordset)
Set connection = Server.CreateObject("ADODB.Connection")
Set recordset = Server.CreateObject("ADODB.Recordset")
'connection.Open "DBQ=" & Server.Mappath(database) & ";Driver={Microsoft Access Driver (*.mdb)};"
'connection.Open "Provider=Microsoft.jet.OLEDB.4.0;Data Source= " & Request.ServerVariables("APPL_PHYSICAL_PATH") & "admin/dbLogin.mdb"
connection.Open "Provider=Microsoft.jet.OLEDB.4.0;Data Source= " & Request.ServerVariables("APPL_PHYSICAL_PATH") & database
End Function

'If user has attempted to log in then do the following
'If Request.QueryString("login") = "true" Then

'Calls dataConn function to open dbLogin.mdb
' dataConn "../../../admin/dbLogin.mdb",LOdc,MErs

'Selects all fields within tblMembers where username and password match those entered by the user
MErs.Open "SELECT * FROM tblMembers WHERE Username='" & Request.querystring("User_id") & "' AND Password = '" & Request.querystring("User_pwd") & "'", LOdc

e scrivi così:

Dim strConn
strConn = "driver={Microsoft Access Driver (*.mdb)};dbq="&_
server.MapPath("dblogin.mdb")&";PWD="

Dim MErs
Set MErs = Server.CreateObject ("ADODB.Recordset")

MErs.Open "SELECT * FROM tblMembers WHERE Username='" & Request.querystring("User_id") & "' AND Password = '" & Request.querystring("User_pwd") & "'", strConn, 3, 3

L'errore generato è dovuto al fatto che non hai creato l'oggetto MErs(nel codice che ho postato viene creato con Set MErs = Server.CreateObject ("ADODB.Recordset") )
Dovrebbe funzionare così...penso di non essermi dimenticato nulla, se così non fosse fammi sapere.
CIAO

No comment...

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.