CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2001
    Location
    Dublin, Ireland
    Posts
    26

    simple piece of code - need help

    hi,

    this is the code

    var UID = objConn.execute("select UID from Tbl_users where EmailName='"+strEmailAddr+"'");
    Response.write(UID);

    it gives an error at the Response.write line, saying:
    Response object error 'ASP 0185 : 8002000e'

    Missing Default Property

    A default property was not found for the object.


    UID is an auto-number in my sql database, and strEmailAddr is a varchar.
    I've tested the sql with query analyzer and it works fine (ie there is a UID value for the particular email address I check), but it doesn't work from my asp page.

    Any ideas?



  2. #2
    Join Date
    May 2001
    Posts
    10

    Re: simple piece of code - need help

    If think this will not work cause you trying to set a var with a recordset... Try to declare UID as and ADODB.Recordset and use
    UID.open "sql command"
    and then use
    response.write(UID("datafield"))

    That's it..


  3. #3
    Join Date
    May 2001
    Location
    Dublin, Ireland
    Posts
    26

    Re: simple piece of code - need help

    tried this:

    var RS = Server.CreateObject("ADODB.Recordset");
    RS.Open("select * from Tbl_users where EmailName='"+strEmailAddr+"'");

    Response.write(RS("UID"));







    It didn't work - gave the following error:


    ADODB.Recordset error '800a0e7d'

    The application requested an operation on an object with a reference to a closed or invalid Connection object.


    what am I doing wrong?



  4. #4
    Join Date
    May 2001
    Posts
    10

    Re: simple piece of code - need help

    I didn't tested it but, the right way is...


    Dim rs, conn

    set conn = Server.CreateObject("ADODB.Connection")
    set rs = Server.CreateObject("ADODB.Recordset")

    'Change it to your connection string
    conn.open "Driver=Microsoft Access Driver (*.mdb);DBQ=your_bd_here.mdb"
    rs.open "select * (......)", conn

    response.write(rs("UID"))




    I think it will work... You only must pay attention to the connection string you'll use.





  5. #5
    Join Date
    May 2001
    Location
    Dublin, Ireland
    Posts
    26

    Re: simple piece of code - need help

    what's the javascript equivalent of:
    set RS = .........

    I've been looking, but I all the examples I can find are in vbscript!

    also, I have my conn.open done already above the piece of code I gave - I don't need to do it again do I?


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured