Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Re: Beginning ASP 3.0 Chap15 code problem please help


Message #1 by "Henry Petersen" <henry@d...> on Fri, 16 Nov 2001 12:47:39
Do you have the enumerator variables defined anywhere in your rsUsers.Open 

statement.  Generally when using ADO in an asp page you need to include 

the file adovbs.inc.  This file defines all the variables necessary to use 

all of the ado objects and methods.



You can find a copy by going to msdn.microsoft.com and doing a search on 

adovbs.





> In the Beginner ASP 3.0 book, chapter 15, is a

> sample application. I custamized my code based on books code:

> 

> File "clssfd.asp" :

> 

> <%

>   Dim objConn

>   Set objConn = Server.CreateObject("ADODB.Connection")

>   objConn.Open "Provider=MSDAORA; Data Source=DOO; User 

> ID=NONE;Password=NONE;"

>   If Session("blnValidUser") = True and Session("USER_ID") = "" Then

>     Dim rsPersonIDCheck

>     Set rsPersonIDCheck = Server.CreateObject("ADODB.Recordset")

>     Dim strSQL 

>     strSQL = "SELECT USER_ID FROM NOW_USER " & _ 

>              "WHERE S_USER_ID = '" & Session("S_USER_ID") & "';"

>     rsPersonIDCheck.Open strSQL, objConn

>     If rsPersonIDCheck.EOF Then

>       Session("blnValidUser") = False

>     Else

>       Session("S_USER_ID") = rsPersonIDCheck("S_USER_ID")

>     End If

>     rsPersonIDCheck.Close

>     Set rsPersonIDCheck = Nothing

>   End If

> %>

> 

> Here is AddUser.asp:

> 

> <!--#include file="clssfd.asp"-->

> 

> <%

>   Dim rsUsers

>   Set rsUsers = Server.CreateObject("ADODB.Recordset")

>   rsUsers.Open "SBC_USER", objConn, adOpenForwardOnly, adLockOptimistic, 

> adCmdTable

>   If Session("USER_ID") <> "" Then                       ' currently 

> logged-on user

>     rsUsers.Filter = "USER_ID = '" & Session("USER_ID") & "'"   

>   Else                                                                 ' 

> New session

>     rsUsers.Filter = "S_USER_ID = '" & Request.Form("S_USER_ID") & "'" & 

_ 

>                      "AND PWD = '" & Request.Form("PWD") & "'"

>     If rsUsers.EOF Then                                             ' 

User 

> not found

>       rsUsers.AddNew                                        ' ...so add 

a 

> new record

> '   Else 

> '     Email address and password matched with DB records - 

> '     In this case we'll allow this to update user's personal details

>     End If

>   End If

>                                                   ' write personal 

details 

> to record

>   rsUsers("S_USER_ID") = Request.Form("S_USER_ID")

>   rsUsers("FIRST_NAME") = Request.Form("FIRST_NAME")

>   rsUsers("LAST_NAME") = Request.Form("LAST_NAME")

>   rsUsers("E_MAIL") = Request.Form("E_MAIL")

>   rsUsers("LEAD_ID") = Request.Form("LEAD_ID")

>   rsUsers("PWD") = Request.Form("PWD")

>   rsUsers("Active") = True

>   rsUsers("Last_Login_Date") = Now

>   rsUsers.Update                                               ' update 

> the database

> 

>   Dim strName, strValue                                   ' create 

session 

> variables

>   For each strField in rsUsers.Fields

>     strName = strField.Name

>     strValue = strField.value

>     Session(strName) = strValue

>   Next

>   Session("blnValidUser") = True            ' declare that current user 

is 

> validated

>   Response.Redirect "MenuForRegisteredUsers.asp"

> %>

> 

> When I am enter a new record, I am getting this error:

> 

> ADODB.Recordset error '800a0bb9' 

> 

> Arguments are of the wrong type, are out of acceptable range, or are in 

> conflict with one another. 

> 

> /bragweb/AddUser.asp, line 6 

> 

> 

> Am I missing Global.asp? if yes what I need to put in Global.asp files 

to 

> make this code work?

> 

> Or this problem is caused by something else. Please help.

> 

> Mav

> 


  Return to Index