fill dropdown-field by sql from sql-server

Discussion created by mapsolution on Dec 14, 2010
Latest reply on Dec 16, 2010 by jamesfreddyc
Dear Esri-Forum,

I have a form in ArcGIS Map wich has a dropdown-field. the rowsource of this dropdown-field should be filled by a sql from a sqldb. the following code I use for connecting to sqldb:

Set dbcon = New adodb.Connection
Set rscenter = New adodb.RecordSet
dbcon.ConnectionString = "Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=True;Data Source=HIMALIA;Initial Catalog=test;"
sSQL = "SELECT [Id] ,[ObjectNumber],[Name], [City] FROM [test].[dbo].[table]"
rscenter.Open sSQL, dbcon, adOpenDynamic, adLockOptimistic

The RecordCount always -1, the Fields are in the recordset. Would be nice to get a hint for this!