troubleshooting Question

MS SQL GROUP BY in VB6

Avatar of Takeoutdinner
Takeoutdinner asked on
Visual Basic Classic
6 Comments1 Solution842 ViewsLast Modified:
Followings are working fine in MS Access Data connection.
But if I change the 2nd line to SQL connection, it doesn't work(No Data).(For SQL Connection, adoconn1.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=myname;Password=mypassword;Initial Catalog=" & dbsource & ";Data Source=" & dbserver 'SQL)
If I do not use GROUP BY, SQL connection works fine.

Would you please help me ?

Thanks,
HD


Set adoconn1 = New ADODB.Connection
adoconn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath & ";Persist Security Info=False"   'MDB

'Populate grid with sample data
Set rs = New ADODB.Recordset
'Group By
selectstr = "SELECT     Status_T.StatusID, Status_T.StatusGrp, SUM(OrderDetail_T.Quantity) AS Qty FROM         Status_T INNER JOIN  OrderDetail_T ON Status_T.StatusID = OrderDetail_T.[Order Status] GROUP BY Status_T.StatusID, Status_T.StatusGrp"
   
rs.Open selectstr, adoconn1, adOpenStatic, adLockOptimistic


   
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros