Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problem updating and inserting data do MS Access

Guest
Jul 10, 2007 Jul 10, 2007
I'm working on a site with ASP technology (VBScript) and a MS Access database.
Everything's been working just fine untill I started building the backoffice.

Since I've been using the Dreamweaver server objects to help me out and my server host didn't give direct access, I solved the problem using 2 different Connection files: one is used locally and refers to the database in Inetpub, the other is remote and uses de function "Mappath". I'm only telling this, in case it might has something to do with the problem I'm having.

So, when I build a page like a simple login to my users, and click the "submit" button on the form, the result is that it neither shows up any error nor it goes to a an of the pages I indicated on the "Login user" Server behaviour. It dows a refresh, and that's it.

Does anyone can help?

Here's the code for a simple login:


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/ligSocomage.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("_login"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="_entrada.asp"
MM_redirectLoginFailed="_erroLogin.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_ligSocomage_STRING
MM_rsUser.Source = "SELECT uLogin, uPass"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM Utilizadores WHERE uLogin='" & Replace(MM_valUsername,"'","''") &"' AND uPass='" & Replace(Request.Form("_pass"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="form" name="formLogin" method="POST" action="<%=MM_LoginAction%>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="right">login</div></td>
<td><input name="_login" type="text" id="_login" /> </td>
</tr>
<tr>
<td><div align="right">pass</div></td>
<td><label>
<input name="_pass" type="text" id="_pass" />
</label></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><label>
<input type="submit" name="Submit" value="Submit" />
</label></td>
</tr>
</table>
</form>
</body>
</html>
TOPICS
Server side applications
307
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 11, 2007 Jul 11, 2007
I can't see any problems with the code though you are using underscores ( _ ) for your form fields and a couple of your pages ,ie, _pass _login _entrada.asp _erroLogin.asp. I perhap would not use this convention, but it should not be an issue.

This might not be a problem with your code. But rather with using an access db. Are you testing you application on your localhost? Does it work in IIS? Quite often with access db's you need to be able to change the file permissions in IIS as well as in windows to allow the application to work properly. If as you say you don't have access to the host then it may not be possible to get it to run. Does your ISP say they can host access databases or do they offer sql or mysql instead?

To get a proper indictaion of the error you are getting you may want to go into Internet Explorer > Tool > Internet Options > Advanced tab - uncheck 'show friendly http error messages'.

Is your page accessible for me to have a look at?

Hope this helps
Paul
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 11, 2007 Jul 11, 2007
LATEST
Hi Paul, first of all let me thank you for your response.

About the underscores, I don't think they might cause any problem, as the rest of the backoffice site is using the same system with no errors.

I'm not testing the site locally, but always in the server: I do the pages in Dreamweaver and put it online by FTP (I use FireFTP). I only configured the site as remote in Dreamweaver so that I could use the Application Objects, being connected to the local database.

My ISP is by now trying to solve the problem, although they first said it has to be the code... I must say that the first thing I asked was them to check the file permissions: everything ok.

If you want to take a look at that test page, you may see it at the eddress http://77.91.201.2/$sitepreview/socomage.pt/teste.asp (my client hasn't changed its domain to this new server yet).

Hope that anyone can help me. This problem is lasting for too long and it's driving me to dispair...

Diana F. Santos
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines