Check out this website for how to make a connection to your 
database.http://www.aspsimply.com/admin/dbconfig.asp
or do a search for ADODB.Connection there are tons of sites with lots of examples to 
help you with  your problem.

Here is an example of how to open a recordset in asp once your connection has been 
created:
(I am assuming you are using Access because in you subjectline you say: Access 
returning empty recordset)
I declare my connection in an Include File like this:

MY INCLUDE FILE START--->

<!-- #Include file="adovbs.inc" -->
<%
Set objConn4 = Server.CreateObject("ADODB.Connection")

'If you don't have a password for your database(you should) leave out the "UID" & 
"PWD" part of the connection string.

objConn4.Connectionstring = "DSN=MYDatabase;DRIVER={Microsoft Access Driver (*.mdb)}" 
& ";UID=" & MYUSERID & ";PWD=" & MYPASSWORD 
%>

<----END OF MY ICLUDE FILE

Now I write my ASP page START ----------->

<!-- #Include file="What ever you decide to name your include file.inc" -->
<%
'objConn4 is the name of my declared ADODB Connection.
    objConn4.open

'Creat my recordset object.

    Set objrsRec3 = Server.CreateObject("ADODB.Recordset")

'My Sequel statement
    sSQL= "SELECT * FROM MyTable WHERE (((MyTable.MyColum)="
    sSQL = sSQL & Lng(request.Form("MyColumCriteriaVariable")) & "))"

'Open my recordset.

    objrsRec3.Open sSQL,objConn4, 2, 3

'Do with my recordset what I need to do.
    With objrsRec3

    'do what ever you need to do

    end with

'When your done with your recordset don't forget to close it.

        set objrsRec3  = nothing

'When your done with your connection don't forget to close it.

   objConn4.Close

'I am not the greatest programmer in the world but this method works great for me.
%>

<---------My ASP Page END
  ----- Original Message ----- 
  From: Alastair Moore 
  To: '[EMAIL PROTECTED]' 
  Sent: Wednesday, June 16, 2004 2:50 AM
  Subject: [AspClassicAnyQuestionIsOk] Access returning empty recordset


  Hi all,

  Got a bizarre problem here..

  sSQL = "SELECT c.*, a.* "
  sSQL = sSQL & "FROM tbl_Content_Page AS c LEFT JOIN tbl_Asset AS a ON
  c.p_asset_id = a.asst_id "
  sSQL = sSQL & "WHERE c.p_id = " & iCurrID

  The above is my query, which is pretty straight forward. If data doesn't
  exist in table A, it should return a recordset with empty fields in the
  relevant A fields. Which it does fine when I run the query in Access.
  However when I run the query in ASP, it returns an empty recordset. It's
  doing my nut in here! Anyone any ideas why this might be?

  Code is dead simple -

  Set oConn = Server.CreateObject("ADODB.Connection")
  oConn.Open sConn

  sSQL = "SELECT c.*, a.* "
  sSQL = sSQL & "FROM tbl_Content_Page AS c LEFT JOIN tbl_Asset AS a ON
  c.p_asset_id = a.asst_id "
  sSQL = sSQL & "WHERE c.p_id = " & iCurrID

  Set oRS = oConn.Execute(sql)

  I'm stumped!

  Alastair

        Yahoo! Groups Sponsor 
              ADVERTISEMENT
             
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
      
    b.. To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to