Thread: No Data exists for the Row/Column - HEELLLLLPPP

Results 1 to 5 of 5
Share This Thread →
  1. #1
    chewystuey is offline Contributing User ASP Free Newbie (0 - 499 posts)
    Join Date
    Jan 2006
    Posts
    81
    Rep Power
    8

    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
    D.O.M.I.N.A.T.O.R's Avatar
    D.O.M.I.N.A.T.O.R is offline Kingpin contributor ASP Free Beginner (1000 - 1499 posts)
    Join Date
    Nov 2005
    Location
    P.E, RSA
    Posts
    1,051
    Rep Power
    205
    Quote 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.

  3. #3
    chewystuey is offline Contributing User ASP Free Newbie (0 - 499 posts)
    Join Date
    Jan 2006
    Posts
    81
    Rep Power
    8
    thats great. so bloody simple!!!!!! been tearing my hair out for a whole day on that! thanks

  4. #4
    berniem is offline Registered User ASP Free Newbie (0 - 499 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 !

  5. #5
    smifsud is offline Registered User ASP Free Newbie (0 - 499 posts)
    Join Date
    Jun 2009
    Location
    Malta
    Posts
    1
    Rep Power
    0

    Thumbs up Thanks!!

    Awesome - so simple! thanks!

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

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

ASP Free Advertisers and Affiliates