Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO Parameters slow
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
ADO Parameters slow
Miscellaneous
Thread ID:
00790812
Message ID:
00790812
Views:
53
All,

I'm having problems assigning parameters to an ADO Command object in my application. When I run the following test code, it takes too long to assign the value to locommand.parameters(0).value and eventually times out. I have the timeout value set to 30 seconds, but I don't really want to increase it since I don't think it should take this long to begin with. When I run the SELECT statement in Query Analyzer, the data comes back within 1 second and there is an index on the sample_id column. This is the only view that I'm having problem with, all others work fine. I'm running VFP 7.0, (tried 8.0 also, same results) and MDAC 2.7 on both my pc and the SQL server box.

Any help would be appreciated.
Thanks,
Kurt
loConnection = CREATEOBJECT('ADODB.Connection')
WITH loConnection
	.Provider = 'SQLOLEDB'
	.Properties("Data Source").Value 	= 'xxxx'
	.Properties("Initial Catalog").Value	= 'xxxx'
	.Properties("User ID").Value		= 'xxxx'
	.Properties("Password").Value		= 'xxxx'
	.Open()
ENDWITH

loCommand = CREATEOBJECT('ADODB.Command')
WITH loCommand
	.ActiveConnection = loConnection
	.CommandType = 1	&& 1 = Text, 4 = Stored Procedure
ENDWITH

loRecordSet = CREATEOBJECT('ADODB.RecordSet')
WITH loRecordSet
	.CursorType 	= 2		&& ADOPENDYNAMIC
	.LockType 	= 4		&& ADLOCKBATCHOPTIMISTIC
	.ActiveConnection = loConnection
	.CursorLocation = 3		&& ADUSECLIENT
ENDWITH

SET STEP ON 
loCommand.CommandText = 'SELECT * FROM dbo.vGetSample WHERE sample_id = ?'
loCommand.Parameters(0).Value = '00286304SQL'

loRecordSet.Open(loCommand)
Next
Reply
Map
View

Click here to load this message in the networking platform