Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-08-19 : 09:19:54
|
| Madhukar writes "Hi there!I got a small problem with a stored procedure with two insert statements and a select statement, something like thisCREATE PROCEDURE [dbo].[test] ASinsert into washtype values('test1','test1','20')insert into washtype values('test2','test2','40')select * from washtypeGOThis works perfect when i run in analyzer. But my problem is i am using visual basic to execute this procedure. It is inserting the two records in the procedure but when selecting the records it is raising an error saying object cannot be opened when it is closed. Any ideas?? (Or do you think this Qn related to VB???)Manythanks in advance!" |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-08-19 : 09:28:06
|
| HiYou need to include a SET NOCOUNT ON at the beginning of your proc, or ADO will get confused.When you do your insert in QA, you might notice the message "1 Record Affected" etc. These get returned to ADO as empty recordsets. It doesn't like it too much.If you put the NOCOUNT statement in, it will supress this and ADO will only get the SELECT returned to it.Hope that helpsDamian |
 |
|
|
|
|
|