
June 25th, 2001, 05:48 PM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
<i><b>Originally posted by : Jerry Scannell (JScannell1@home.com)</b></i><br /><br /><br /><br />------------<br />Errol at 3/29/2001 11:48:42 AM<br /><br /><br />Ok here's my situation. I have a /web directory and a /data directory. I uploaded my access97 database to my /data directory. I had my web server admin make a DSN for my database called DSNSODB.<br />Now before uploading my database i put in one record in my database. I use this code below to connect to my database and i'm not sure why my page isn't working and I have not been able to connect to this database yet! Please tell me if I'm missing anything in this code or if you see something wrong that could be causing this error.<br /><br /><!-- #include file="adovbs.inc" --><br /><HTML><br /><HEAD><br /><TITLE><br /></TITLE><br /><BODY><br /><br />blah<br /></BODY><br /></HTML><br /><br /><%<br />'DECLARE THE MSACCESS 97 DATABASE CONNECTION, RECORDSET, SQL SEARCH VARIABLES<br />Dim dbCONN, dbRS, dbSQL<br /><br /><br />'SET THE CONNECTION OBJECT AND DATA SOURCE NAME<br />Set dbCONN = Server.CreateObject("ADODB.Connection")<br />dbCONN.Open "DSN=DSNSODB"<br /><br /><br />'DECLARE USERNAME & PASSWORD VARIABLES AND RETRIEVE USER INPUT<br />Dim str_CurrentUserId<br />Dim str_CurrentUserPwd<br />str_CurrentUserId = Request.Form("txt_CurrentUserId")<br />str_CurrentUserPwd = Request.Form("txt_CurrentUserPwd")<br /><br /><br />'SET SESSION ERROR VARIABLES TO FALSE BEFORE PROCESSING<br />Session("Session_ErrorUserId_Blank") = False<br />Session("Session_ErrorUserPwd_Blank") = False<br />Session("Session_ErrorUserId_Invalid") = False<br />Session("Session_ErrorUserPwd_Invalid") = False<br /><br /><br />'CHECK TO MAKE SURE VALUES ARE ENTERED, THEN SEARCH ACCESS97 TO SEE IF USER EXISTS<br />IF str_CurrentUserId = "" or str_CurrentUserPwd = "" THEN<br />IF str_CurrentUserId = "" THEN<br />Session("Session_ErrorUserId_Blank") = True<br />END IF<br />IF str_CurrentUserPwd = "" THEN<br />Session("Session_ErrorUserPwd_Blank") = True<br />END IF<br />Response.Redirect "ExistingMemberLogin.asp"<br />ELSE<br />dbSQL = "Select UserId, UserPwd, LastName, FirstName, EmailAddress From UserInfo Where UserId=" & str_CurrentUserId & " AND UserPwd=" & str_CurrentUserPwd <br />Set dbRS = Server.CreateObject("ADODB.Recordset")<br />dbRS.Open dbSQL, dbCONN<br />IF dbRS.EOF THEN<br />Session("Session_ErrorUserId_Invalid") = True<br />Session("Session_ErrorUserPwd_Invalid") = True<br />dbRS.Close<br />Set dbRS = Nothing<br />dbCONN.Close<br />Set dbCONN = Nothing<br />Response.Redirect "ExistingMemberLogin.asp"<br />ELSE<br />Session("Session_UserId") = dbRS("UserId")<br />Session("Session_UserPwd") = dbRS("UserPwd")<br />Session("Session_FirstName") = dbRS("FirstName")<br />Session("Session_LastName") = dbRS("LastName")<br />Session("Session_EmailAddress") = dbRS("EmailAddress")<br />dbRS.Close<br />Set dbRS = Nothing<br />dbCONN.Close<br />Set dbCONN = Nothing<br />Response.Redirect "/index.asp"<br />END IF<br />END IF<br />%><br /><br /><br />It says Page can not be displayed. If you leave the userid and password blank it redirects back and displays the error messages but if you supply the userid and password it says Page Cannont be displayed. So I believe it's the RS.Open method that is causing the error. Any thoughts? Could the DSN be setup incorrectly? The record that I added is userid= errol78 and the psword= blah. The url to the site is www.spiritualism-online.com/Flogin/login.asp and then click the Click Here link on that site. <br /><br /><br />The problem is most likely in the ODBC driver. Merely making an ODBC driver isn't enough. You have to tell the driver where to find the database. Where is the directory /data actually located? Off of what root? (perhaps c:/inetpub/wwwroot/some-dir/some-other-dir/data?) <br /><br />If so, then the DSNSODB has to be configured to point to that access file. Also make sure that the directory /data is part of a sharable path. Any you might even have a problem with the drive letter! I have seen instances where the assumption of Drive C: is incorrect!<br /><br />Hopefully these ideas will help and get you finding your data.<br />
|