Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Feb 2003
    Location
    DC Metro, District Of Columbia, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    recordset.methods

    Hi all:
    I have a web page asp page with some asp script -- here is some ---

    Dim objRS

    Set objRS = Server.CreateObject("ADODB.Recordset")
    ' rem'd objRS.Open SQL, objConn, 1, 1, 1 'adOpenStatic,adLockReadOnly,adCmdTable

    ' SQL = "SELECT * FROM tblUsers" & _
    ' "WHERE tblUsers.password ='strPassword'" & _
    ' "AND tblUsers.emailaddress ='strEmailAddress'"

    objRS.Open "tblUsers", objConn, 2, 2, 2 'adOpenStatic,adLockPessimistic,adCmdTable
    objRS.MoveFirst
    objRS.Find "emailaddress = 'strEmailAddress'"

    If objRS.EOF Then
    Response.Redirect("eof.asp")
    End If
    ----------
    Soooooooooo,
    the various objRS.Methods -- open, movefirst, find, et al show up in a syntax color combo (DW MX) the object in black and the method in purple. However, the objRS.Find is all black text, no color changes and the If stmt is always executed, as I believe the find method is not working.
    My Question is : how can I see all the dotMethods associated with the recordset object I created with the -- Set objRS = Server.CreateObject("ADODB.Recordset")
    line. Reckon I'm spoiled by Access and VB, cuz they display the dropdown list when you add the dot to the object, which lets me know the valid methods I can use. Again, is there a way to display the methods associated with a created object using DW MX?
    TIA,
    jl

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: recordset.methods

    Your Find should always fail because you are using the literal criterion 'strEmailAddress' -- so that would be the first thing to check.

    What "provider" are you using for objConn? The .Find method is not supported by all providers. You can use this code to check on that:

    If objRS.Supports(adFind) Then
    Response.Write "

    The Find method is supported.</p>"
    Else
    Response.Write "

    Sorry, no can .Find right now.</p>"
    End If

    Added: I guess I didn't answer your actual question. You mean in Dreamweaver? I don't know. VB and Access use your variable declarations to supply Intellisense, and because VBScript/ASP uses only variants, I think this might be a tall order for Dreamweaver. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

  3. #3
    Star Lounger
    Join Date
    Feb 2003
    Location
    DC Metro, District Of Columbia, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: recordset.methods

    Tanx J and you actually answered 'all' of the ?, both the literal and the unasked, yet asked <grin>. Soooooo, the include file --->
    <%
    '-- data source include file for tower-frequency

    Dim objConn

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

    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=Inetpubwwwroottower-frequencydblogin-asp.mdb;" & _
    "Persist Security Info=False"
    %>

    The Wrox beg asp 3.0 book I am using suggested I use the above provider as opposed to the other MS connection type which DW allows as a choice when using the default DW connection wizard -- which works like sh, errrrr, has multiple errors and does not work, thus, the book and help from real users/developers. Again, tanx and I hope the include answer helps locate my errors. I will, meanwhile, use the code you provided to check for the adFind method. Hmmmm, as an aside, the Wrox book pointed me to the adovbs.inc file which shows lots of items and their settings. I will also check that file to see how vbs spells/uses the find method.
    jl

  4. #4
    Star Lounger
    Join Date
    Feb 2003
    Location
    DC Metro, District Of Columbia, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: recordset.methods

    So, I should rewrite the find with what criterion? Here is the first part of my script ----->

    '-- Do not process script until form displayed and filled in
    If Request.Form("btnLogin") = "Login" Then

    '-- Declaring and initing variables
    Dim strPassword, strEmailAddress, strUserLevel, SQL

    strPassword = Request.Form("txtPassword")
    strEmailAddress = Request.Form("txtEmailAddress")
    strUserLevel = "Not Authorized"

    '-- Set up the recordset var and connection
    Dim objRS

    Set objRS = Server.CreateObject("ADODB.Recordset")
    ' objRS.Open SQL, objConn, 1, 1, 1 'adOpenStatic,adLockReadOnly,adCmdTable

    ' SQL = "SELECT * FROM tblUsers" & _
    ' "WHERE tblUsers.password ='strPassword'" & _
    ' "AND tblUsers.emailaddress ='strEmailAddress'"

    objRS.Open "tblUsers", objConn, 2, 2, 2 'adOpenStatic,adLockPessimistic,adCmdTable
    ------->

    Does this help?

    Also, I tried the objRS.Supports(adFind) -- the Supports went to purple - I suppose the RS object likes it - but I did not get either message on the login form, tried alert(msg) and msgbox(msg), he he, iis no likes!!! errors!! Do I need to use this in html as I did this right in the script? Again, TIA,
    jl

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: recordset.methods

    You have two choices of providers for an Access database. One is the "native" OLE DB provider, which has a name in the style you have above (I haven't looked up whether you have a precise match; some of the WROX books have typos!). The second is the generic ODBC provider, which has a name similar to MSDASQL, 'though I forget the exact name. Your should be fine if the file format is Access 2000 or newer. If it is Access 97, your provider might not be backward compatible, but it has been so long that I'm not certain about that.

    Regarding adovbs.inc, in order to use any ADO constants (like adFind), you need to reference either the .inc file or the .dll file. For more info, see the first few posts in this thread: Declare cursor type in DataConnection SQL Server. I don't know if this will help Dreamweaver, but hopefully it will help the web server. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: recordset.methods

    No output from Response.Write probably means that part of the code is not running.

    Hmmm... this part seems fishy:
    <hr>'-- Do not process script until form displayed and filled in
    If Request.Form("btnLogin") = "Login" Then<hr>
    Something about the value of a button?? You probably want to design your page so that the user only loads it after she or he has entered a username and password. In other words, your page is the ACTION parameter in the FORM. Then, you can just look at the values supplied by the form, and not worry about the button.

    What happens if you comment out this criterion and instead check whether the e-mail address is blank before running your database query code?

    Because your ASP VBScript code runs on the server before the page is rendered, and not in the browser, if you did want to stop the user from submitting a page with, say, a blank password, you would need to use JavaScript (or, in an IE-only environment, client-side VBScript).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •