Having trouble with this code

Results 1 to 2 of 2

Thread: Having trouble with this code

  1. #1
    Bobby Guest

    Default Having trouble with this code

    &#060;%@LANGUAGE="VBSCRIPT"%&#062; &#060;%<BR>set AllAnswers = Server.CreateObject("ADODB.Recordset")<BR>AllAnswe rs.ActiveConnection = "dsn=QandA;"<BR>twoWeeksBack=DateDiff("d",-14,Date)&#039go back 14 days<BR>AllAnswers.Source = "SELECT * FROM qAndA WHERE dateEntered&#062;#"& twoWeeksBack& "#ORDER BY dateEntered"<BR>SetRS=QandA.execute<BR><BR>This code is supposed to limit the results of the query to just two weeks, but I get an object error. Anyone have any ideas why? I think it has something to do with [SetRS=QandA.execute], but I&#039m not sure. Thanks.

  2. #2
    samel Guest

    Default RE: Having trouble with this code

    It&#039s the line<BR>AllAnswers.ActiveConnection = "dsn=QandA;"<BR>This is just not how you use a recordset. You&#039ll have to create a Connection object then use it to open your recordset. Couple of ways to do that. Take a look at some of the ADO tutorials on this site for awhile. It will save you a lot of time.

Posting Permissions

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