Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset problem

Status
Not open for further replies.

false420

Programmer
Mar 31, 2005
87
US
Im having trouble creating a recordset with ado from a sql database. My connection worked fine , i think it may have to do with the cursor i am using. or i may be going about this the wrong way. can anyone help please. here is my code. i get this error:

Microsoft OLE DB Provider for ODBC Driverserror '80040e21'
ODBC driver does not support the requested properties.

strDetailedInfo = "SELECT DISTINCTROW " & service & ".Carrier, " & service & ".Account, " & service & ".Cost_Center, " & service & ".Long_Date, Sum(" & service & ".Total) AS Total, Sum(" & service & ".Actual_Past_Due) AS Actual_Past_Due, Sum(" & service & ".Credit) AS Credit FROM " & service & ", UID_CostCenter WHERE (" & service & ".Long_Date BETWEEN #" & currYear & "# AND #" & nextYear & "#) AND " & service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' Group By " & service & ".Cost_Center, " & service & ".Carrier, " & service & ".Account, " & service & ".Long_Date"

Set objRS_DetailedInfo = Server.CreateObject("ADODB.Recordset")
objRS_DetailedInfo_Open strDetailedInfo,objConn,adOpenKeyset
 
Do you have the adXXXX constants defined somewhere ?
If no, then add this:
Const adOpenKeyset = 1
Another notes:
1) Don't use DISTINCT nor DISTINCTROW predicate within an aggregate (GROUP BY) query
2) With SQL server the syntax for literal DateTime is 'yyyy-mm-dd hh:nn:ss' (ie no #)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top