Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INSERT prevents recordset from returning from SP
Message
From
27/06/2001 13:11:27
 
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00523646
Message ID:
00524296
Views:
18
>Would you post some code that duplicates the problem. Maybe using pubs or northwind?
>
>-Mike

Sure:
Add this stored procedure to pubs database:
CREATE PROCEDURE create_publisher
	@pub_id 	char(4),
	@pub_name 	varchar(40),
	@city 		varchar(20),
	@state 		char(2),
	@country 	varchar(30)
 AS
/* barebones, not checking for dups */

INSERT INTO publishers (pub_id, pub_name, city, state, country)
VALUES (@pub_id, @pub_name, @city, @state, @country)

SELECT * FROM publishers WHERE pub_id = @pub_id
VFP Code:
* sptest.prg
lparameters llUseOleDBProvider, lcPubID
* llUseOleDBProvider: pass in .t. to use OLEDB, .f. for ODBC
* lcPubID: must be in format of '99xx', and must be unique in publishers table
*          This is a restriction in the pubs database
? ""
? "Begin..."
oConnection = CREATEOBJECT("ADODB.Connection")

if llUseOleDBProvider
	lcConn = "Provider=SQLOLEDB.1;Persist Security Info=False;"+;
		"User ID=sa;Initial Catalog=pubs;Data Source=orange"
else
	lcConn = "DRIVER={SQL Server};SERVER=orange;database=pubs;uid=sa;pw="
endif

oConnection.open(lcConn)

oCmd = createObject("adodb.command")
with oCmd
	.commandtype = 4
	.activeConnection = oConnection
	.commandText = 'create_publisher'
	.parameters("@pub_id") = lcPubId
	.parameters("@pub_name") = 'Little Bitty Publisher'
	.parameters("@city") = 'Dallas'
	.parameters("@state") = 'TX'
	.parameters("@country") = 'USA'
endwith
? "Parameters:"
for each opar in ocmd.parameters
	? opar.name, opar.value          && so far so good...
next opar
oRs = oCmd.execute
&& With OLEDB provider, next line fails, and fields collection is empty
* ? orS.eof()
? ""
? "Fields contained in recordset:"
for each fld in ors.fields
	? fld.name,":",fld.value
next fld
? "End..."
If you put VFP code into sptest.prg, and in command window:
do sptest with .f., '9933'   && works great
do sptest with .t., '9934'   && less filling :)
On client, running W2K with the data services that come installed with W2K. On server running W2K Server w/MSDE SQL Server 7.

Thanks,
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform