|
Subject:
|
Initialization error"adOpenforwardOnly"
|
|
Posted By:
|
ali
|
Post Date:
|
10/26/2003 3:40:50 PM
|
Hi everybody i am receiving the error regarding the initialization of adOpenForwardOnly,adLockOptimistic and adCmdTable and as i initialize it then it gives me the error"Arguments are of wrong type and are out of acceptable range or are in conflict with each other" i have also used option explicit and still the error is there please Help Ali
|
|
Reply By:
|
Imar
|
Reply Date:
|
10/26/2003 4:38:34 PM
|
Hi Ali,
You may want to take a look here: http://www.adopenstatic.com/faq/800a0bb9.asp or in any of the other FAQs on that site.
If that doesn't help, I suggest you post some code so we can take a look at it.
Cheers,
Imar
--------------------------------------- Imar Spaanjaars Everyone is unique, except for me.
|
|
Reply By:
|
ali
|
Reply Date:
|
10/26/2003 4:59:33 PM
|
hi everybody the piece of code is as follows Dim objConn Dim rsUsers Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0 ; Data Source= F:\Ch15\classified_2000.mdb" Set rsUsers = Server.CreateObject("ADODB.Recordset") rsUsers.Open "Person", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable If Session("blnValidUser") = True and Session("PersonID") = "" Then Dim rsPersonIDCheck Set rsPersonIDCheck = Server.CreateObject("ADODB.Recordset") Dim strSQL Ali
|
|
Reply By:
|
Imar
|
Reply Date:
|
10/26/2003 5:55:52 PM
|
How and where are you declaring the ad* constants? Are you using an include file, or are you declaring them in your code?
I think the error is caused by incorrect values for the ad* constants, but you'll need to post some more code before I can see how things are set up.
Cheers,
Imar
--------------------------------------- Imar Spaanjaars Everyone is unique, except for me.
|
|
Reply By:
|
ali
|
Reply Date:
|
10/26/2003 6:36:20 PM
|
hi Imar please can u tell me how to declare constants because i havent done itand also i am not using any header file,the code is as follows: <%Option Explicit%> <% Dim objConn Dim rsUsers Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0 ; Data Source= F:\Ch15\classified_2000.mdb" Set rsUsers = Server.CreateObject("ADODB.Recordset") rsUsers.Open "Person", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable If Session("blnValidUser") = True and Session("PersonID") = "" Then Dim rsPersonIDCheck Set rsPersonIDCheck = Server.CreateObject("ADODB.Recordset") Dim strSQL strSQL = "SELECT PersonID FROM Person " & _ "WHERE EMailAddress = '" & Session("EMailAddress") & "';" rsPersonIDCheck.Open strSQL, objConn If rsPersonIDCheck.EOF Then Session("blnValidUser") = False Else Session("PersonID") = rsPersonIDCheck("PersonID") End If rsPersonIDCheck.Close Set rsPersonIDCheck = Nothing End If If Session("PersonID") <> "" Then ' currently logged-on user rsUsers.Filter = "PersonID = '" & Session("PersonID") & "'" Else ' New session rsUsers.Filter = "EMailAddress = '" & Request.Form("email") & "'" & _ "AND Password = '" & Request.Form("password") & "'" 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("EMailAddress") = Request.Form("email") rsUsers("Password") = Request.Form("password") rsUsers("FamilyName") = Request.Form("FamilyName") rsUsers("GivenName") = Request.Form("GivenName") rsUsers("StreetAddress1") = Request.Form("Address1") rsUsers("StreetAddress2") = Request.Form("Address2") rsUsers("City") = Request.Form("City") rsUsers("State") = Request.Form("State") rsUsers("PostalCode") = Request.Form("PostalCode") rsUsers("Country") = Request.Form("Country") rsUsers("Active") = True rsUsers("LastLogin") = 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" %> Thanks for the help Ali
|
|
Reply By:
|
alyeng2000
|
Reply Date:
|
10/26/2003 10:38:54 PM
|
hi ali
the constants file name is ADOVBS.INC (ADO library constants), it is declared as folows <!-- #Include File="ADOVBS.INC" -->
Ahmed Ali Software Developer
|
|
Reply By:
|
ali
|
Reply Date:
|
10/27/2003 12:34:43 AM
|
Ahmed Ali Thanks for the help but the error remains the same Variable Is Undefined "adOpenForwardOnly" Ali
|
|
Reply By:
|
Imar
|
Reply Date:
|
10/27/2003 12:30:52 PM
|
Hi there,
If you use any ADO constant, like adOpenForwardOnly etc, ASP has to know what adOpenForwardOnly really means. There are a couple of ways to tell ASP where to look for these constants:
1. Declare them yourself: Const adOpenForwardOnly = 0 Not recommended, because you have to do this on every page where you use the constant, or include your own file.
2. Include the adovbs.inc file, (found in C:\Program Files\Common Files\System\Ado by default) with the following code (you'll need to copy it to your virtual root of your website or modify the path in the statement):
<!--#include virtual="/adovbs.inc"-->
3. Add a reference to the ADO dll in your global.asa. For this to work, you need to know the exact location of the DLL which can be a problem if you use an ISP or can't / don't use the global.asa.
However, imo this is the recommend way, because all constants are included directly from the source. If anything ever changes, there's no risk you have an old include file:
<!--METADATA TYPE="typelib" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" NAME="ADODB Type Library" -->
Modify the above path to match your location of msado15.dll
HtH,
Imar
--------------------------------------- Imar Spaanjaars Everyone is unique, except for me.
|