Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 23rd, 2009, 01:50 AM
Registered User
 
Join Date: Feb 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to fetch from output procedure

I have the following Stored Procedure on vb code. My problem is that I am not sure how to properly of the correct syntax to fetch from output of the stored procedure.
Does anyone know how to write the VB.Net coding to fetch from the output?
Below is the coding that i have create.
I appreciate if got any suggestion.

Dim strSQL As String = "declare @Indicator int exec @Indicator=SP_Production_InsertNewSupplier '" & txtLogin.Text & "','" & txtPassword.Text & "'," & _
"'" & txtQuestion.Text & "','" & txtAnswer.Text & "','" & txtCompanyID.Text & "','" & txtFullName.Text & "','" & txtContact.Text & "','" & txtPhone.Text & "','" & txtHandphone.Text & "'," & _
"'" & txtFax.Text & "','" & txtEmail.Text & "','" & txtAddress.Text & "','" & txtPostCode.Text & "','" & txtCity.Text & "','" & cboCountry.Text & "'," & _
"'" & txtEnquiry.Text & "' select Indicator=@Indicator"
Dim cmdInsert As SqlCommand = New SqlCommand(strSQL, cnnOTS)

Last edited by anachin; February 23rd, 2009 at 02:10 AM..
  #2 (permalink)  
Old February 23rd, 2009, 02:26 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Anachin,

Please find the code for you reference. It will help you.

Dim mycmd As New SqlCommand

mycmd.Connection = CONN //Connection string

mycmd.CommandText = "strproc"

mycmd.CommandType = CommandType.StoredProcedure

Dim Param1 As New SqlClient.SqlParameter("@dbasename", SqlDbType.Char, DbName)

Dim Param2 As New SqlClient.SqlParameter("@tblname", SqlDbType.Char, tblName)

Dim Param3 As New SqlClient.SqlParameter("@dbase_id", dbid)

Dim Param4 As New SqlClient.SqlParameter("@table_id", tbid)

Param1.Direction = ParameterDirection.Input

Param2.Direction = ParameterDirection.Input

Param3.Direction = ParameterDirection.Output

Param4.Direction = ParameterDirection.Output

mycmd.Parameters.Add(Param1)

mycmd.Parameters.Add(Param2)

mycmd.Parameters.Add(Param3)

mycmd.Parameters.Add(Param4)

CONN.Open()

mycmd.ExecuteNonQuery()


Let me know if you need any more help.
Regards,
Kaustubh M.
  #3 (permalink)  
Old February 23rd, 2009, 03:18 AM
Registered User
 
Join Date: Feb 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the suggestion.

how do i return the value with SQL ",,,, select Indicator=@Indicator"
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get Stored Procedure Output using Access VBA LandLocked Access VBA 3 June 20th, 2007 11:20 AM
XML Output from stored procedure NigelBronson ASP.NET 2.0 Basics 0 October 15th, 2006 06:24 PM
output parameter from MS SQL stored procedure nav1 VB How-To 0 March 14th, 2005 05:00 PM
Calling stored procedure with output parameters bansalh SQL Server 2000 2 November 10th, 2004 11:00 AM
fetch in background? RCC_msolomon ADO.NET 6 June 25th, 2003 10:39 PM



All times are GMT -4. The time now is 07:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.