ContributionsMost RecentMost LikesSolutionsRe: Windows CE support? Vote for window CE too!!! Re: Is there a way to return the name of the current sub routine or function? Please add my vote as well! Re: ADO RecordSet is not working haha, I think I just remove that USE command!!! Thanks all the same ;-) Have a great day.:smileyhappy: Alice Re: ADO RecordSet is not working Actually I copied the query to run in the sql server, it returns results. The problem is USE TableA, if I prefix the database to the table , it's working fine. eg. TableA.dbo.location. Any idea on this issue? Thanks Re: ADO RecordSet is not working The state is 1. And I just verify these codes, recset is not used anywhere else. Thanks for your help ;-) ADO RecordSet is not working I got the error when go to MoveFirst : Operation is not allowed when the object is closed. However , if I use a simple query like "Select * from location" , it's working fine. Below is code. Anyone has any idea on this? strQuery = "USE TableA "&_ "SET NOCOUNT ON "&_ "DECLARE @Name varchar(100) = '<%Name%>' "&_ "DECLARE @Alias varchar(100) = '<%Zone Alias%>' "&_ "DECLARE @ID varchar(10) "&_ "SET @ID = (SELECT id FROM sites WHERE name = @Name) "&_ "SELECT uid "&_ "FROM "&_ "location AS loc, "&_ "zone AS zone, "&_ "epc AS epc "&_ "WHERE "&_ "loc.epc_id = epc.epc_id AND "&_ "loc.zone_id = zone.zone_id AND "&_ "loc.is_removed = '0' AND "&_ "zone.alias = @Alias AND "&_ "zone.id = @ID "&_ "ORDER BY "&_ "epc.epc_urn " ' Create a Connection object strQuery = Replace(strQuery,"<%Name%>",strName) strQuery = Replace(strQuery,"<%Alias%>",strAlias) strQuery= "SELECT site_id FROM [VUE_DM].[dbo].[sites] WHERE site_name ='Site1' " Set AConnection = ADO.CreateADOConnection ' Set rs = ADO.CreateADODataSet ' Specify the connection string AConnection.ConnectionString = "Provider=SQLOLEDB;DSN=TableA;Uid=sa;Pwd=" & ProjectSuite.Variables.SQLServerPassword & ";" ' Suppress the login dialog box AConnection.LoginPrompt = False AConnection.Open ' Remove if already there Set oRecSet = AConnection.Execute_(strQuery) ' ' Processes data oRecSet.MoveFirst Thanks, Alice Solved