Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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..
 
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.
 
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"





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.