Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-02-08 : 10:12:27
|
| gerry writes "I'm trying to replace the followingSELECT ID FROM AvailDates WHERE 'Inputdate1' >= Adate1 AND 'Inputdate2'<= Adate2 OR 'Inputdate1' >= Adate2 AND 'Inputdate2'<= Adate3 OR'Inputdate1' >= Adate3 AND 'Inputdate2' <= Adate4 OR 'Inputdate1' >=Adate4 AND 'Inputdate2'<= Adate5with the following looping statement.9Wherever I put the for/next loop it doesn't work as an OR statement. I justget results for n=4 or errors0Dim nset Recordset1 = Server.CreateObject("ADODB.Recordset")Recordset1.ActiveConnection = MM_MySite_STRINGfor n=1 to 4Recordset1.Source = "SELECT ID FROM AvailDates WHERE '" +Replace(Recordset1__Inputdate1, "'", "''") + "' >= Adate" & n & " AND '"+ Replace(Recordset1__Inputdate2, "'", "''") + "'<= Adate" & n+1 & " "NextRecordset1.CursorType = 0Recordset1.CursorLocation = 2Recordset1.LockType = 3Recordset1.Open()Recordset1_numRows = 0Thanks" |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2002-02-08 : 12:28:01
|
| I don't know ADO, but it looks to me like you're setting the recordset's source property to 4 different values and opening the recordset after setting it to the last one. |
 |
|
|
bcollinson
Starting Member
9 Posts |
Posted - 2002-02-08 : 12:34:22
|
| You're looping through and setting the source for the recordset, but you're not actually retrieving any records until after you've exited the loop (n = 4). |
 |
|
|
|
|
|