Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old August 14th, 2003, 11:11 AM
xcor635 xcor635 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 xcor635 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SQL 2K Stored Procedure: VB.NET

This is my first shot at using Stored Procedures and VB. I have always used direct quaries against the DB. I AM HAVING TROUBLE AND NEED HELP. When I return a value from my stored procedure, if there's more than one row returned, how do I handle it? Here is my stored procedure:

CREATE PROCEDURE [dbo].[paw_GetOpenDates]
(@WEEK int,
@TEAMID nvarchar OUTPUT)
AS
SELECT HomeID
FROM Schedule
WHERE (VisitorID = 'NO') AND (Week = @WEEK)
RETURN
GO

Here is my VB Code:

Dim cn As SqlConnection = New SqlConnection("server=10.1.11.2;initial catalog=POWPOW;User ID=PAN;Password=PANDA;")
Dim sqlcmd As SqlCommand = New SqlCommand("paw_GetOpenDates", cn)
sqlcmd.CommandType = CommandType.StoredProcedure
Dim sp As SqlParameter

' Dim SBError As New StringBuilder
sp = sqlcmd.Parameters.Add("@WEEK", SqlDbType.Int)
sp.Value = 1
' Count Output Parameter
sp = sqlcmd.Parameters.Add("@TEAMID", SqlDbType.NVarChar)
sp.Size = 50
sp.Direction = ParameterDirection.Output
Try
cn.Open()
sqlcmd.ExecuteNonQuery()
--> dim jj =sqlcmd.Parameters("@TEAMID").Value <--
Catch objException As SqlException
Dim objError As SqlError
For Each objError In objException.Errors
MsgBox(objError.Message)
Next
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
cn.Dispose()
cn = Nothing
End Try

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > SQL 2K Stored Procedure: VB.NET


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway