You are here: Re: Return from store procedure. « MsSQL Server « IT news, forums, messages
Re: Return from store procedure.

Posted by Erland Sommarskog on 09/13/05 13:48

vassone (vassone@gmail.com) writes:
> Sub OpenDB( myRS, myConn, mySQL)
> Execute "Set " & myConn & "=Server.CreateObject(" & chr(34) &
> "ADODB.Connection" & chr(34) & ")"
> Execute myConn & ".ConnectionString =" & chr(34) &
"Provider=SQLOLEDB.1;
> Integrated Security=SSPI; Persist Security Info=False;User ID=iusr_ljmu;
> Initial Catalog=HEAPADLive; Data Source=SQLSER2" & chr(34)
> Execute myConn & ".Open"
> Execute "Set " & myRS & "=Server.CreateObject(" & chr(34) &
> "ADODB.Recordset" & chr(34) & ")"
> Execute myRS & ".ActiveConnection = " & MyConn
> Execute myRS & ".Open mySQL," & myConn & ",1,2,1"
> End Sub

> should I be using "cmd.CommandType = adCmdStoredProc"

Yes. I don't really understand why you get the error message, but you cannot
get the value of the output parameter when you do it this way. There is no
place to recieve the value of the parameter.

Instead use the Command object, and then use .CreateParameter to add
parameter. For each parameter you can specify the direction. You can also
use .Refresh to get the parameter list filled in automatically, but this
requires a server round-trip, so it's not the best for performance.

I'm sorry, but I don't have any samples to show on CreateParameter (I
don't speak ADO that fluently), but it's documented in MSDN Library.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация