#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2006
    Posts
    81
    Rep Power
    9

    No Data exists for the Row/Column - HEELLLLLPPP


    hey peeps

    im teaching myself VB.net and have come accross a small prob -

    i have created a login page which accesses data from and MS Access db table.

    The login works fine

    however i am trying to place the clientid into a session variable and am getting the above error. Data does exist in the table and it is retrieving it. here is the code - hope u can help

    objcmd= New oledbcommand("Select * from ClientTable " & _
    "where username='" & strUsername & _
    "' AND Password='" & strPassword & "'", objconn)

    objconn.open()
    objDR = objcmd.executereader()
    if objDR.HasRows then
    session("currentlog")=objdr("clientid")
    end if

    objDR.close()


    somebody please enlighten me

    i have also tried
    session("currentlog")=objdr.item("clientid") and
    session("currentlog")=objdr(0)

    thanks in advance


    stu
  2. #2
  3. Kingpin contributor
    ASP Good Citizen (1000 - 1499 posts)

    Join Date
    Nov 2005
    Location
    P.E, RSA
    Posts
    1,051
    Rep Power
    206
    Originally Posted by chewystuey
    hey peeps

    im teaching myself VB.net and have come accross a small prob -

    i have created a login page which accesses data from and MS Access db table.

    The login works fine

    however i am trying to place the clientid into a session variable and am getting the above error. Data does exist in the table and it is retrieving it. here is the code - hope u can help

    objcmd= New oledbcommand("Select * from ClientTable " & _
    "where username='" & strUsername & _
    "' AND Password='" & strPassword & "'", objconn)

    objconn.open()
    objDR = objcmd.executereader()
    if objDR.HasRows then
    session("currentlog")=objdr("clientid")
    end if

    objDR.close()


    somebody please enlighten me

    i have also tried
    session("currentlog")=objdr.item("clientid") and
    session("currentlog")=objdr(0)

    thanks in advance


    stu
    Remeber the If objDR.read() Then ... Like below

    Code:
    objconn.open()
    objDR = objcmd.executereader()
    
    if objDR.read() then
    session("currentlog")=objdr("clientid")
    end if
    
    
    objDR.close()

    objDR.HasRows does not take you to the first record in the datareader, but objDR.read() does.
  4. #3
  5. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2006
    Posts
    81
    Rep Power
    9
    thats great. so bloody simple!!!!!! been tearing my hair out for a whole day on that! thanks
  6. #4
  7. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2007
    Posts
    1
    Rep Power
    0

    Thumbs up


    Thank you from me also - I'm not usually slow on finding stuff on the internet but it took me a good few hours of messing around before I found this. The journey from Classic ASP is not a particularly easy one !
  8. #5
  9. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2009
    Location
    Malta
    Posts
    1
    Rep Power
    0

    Thumbs up Thanks!!


    Awesome - so simple! thanks!

Similar Threads

  1. listen Data File & Store Data into DB
    By mazhiqi in forum ASP Development
    Replies: 0
    Last Post: March 28th, 2005, 05:00 PM
  2. testing if a field is empty
    By tonya in forum ASP Development
    Replies: 18
    Last Post: March 27th, 2003, 01:06 PM
  3. a data monitoring ASP
    By wancherng in forum .NET Development
    Replies: 0
    Last Post: March 18th, 2003, 08:37 AM
  4. Web page refreshes but data doesn't refresh!!!
    By Steve Schofield in forum .NET Development
    Replies: 1
    Last Post: February 15th, 2002, 11:21 AM
  5. Replies: 1
    Last Post: February 12th, 2002, 06:57 PM

IMN logo majestic logo threadwatch logo seochat tools logo