Solved

Accessing Stored Procedure Parameters (Sequel Server 2002) from VB6

Posted on 2003-10-22
8
264 Views
Last Modified: 2010-04-17
I have problems reading my OUTPUT parameters from Stored Procedures as well as passing an input value into it from VB6.
0
Comment
Question by:ManiKing
8 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 9597910
Hi ManiKing,

Can you show the code you are currently trying to use and then we can suggest how to resolve the problem.

Tim Cottee MCSD, MCDBA, CPIM
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 
LVL 4

Accepted Solution

by:
Sandeepk1999 earned 43 total points
ID: 9617854
Make sure you are passing the parameters in right order and have used exact parameter names in your code.
0
 
LVL 1

Assisted Solution

by:Junior_Pete
Junior_Pete earned 41 total points
ID: 9620327
If you are using an ADODB.Command object try the following

'Setup the command object as normal without the parameters.

oCmd.ActiveConnection = conn
oCmd.CommandTimeout = 45
oCmd.CommandType = adStoredProcedure
oCmd.CommandText = "Stored Procedure name here"

'Then instead of manually adding the parameters do this

oCmd.Refresh  ' or oCmd.Parameters.Refresh (cant quite remember which one)

'This should collect the params from the database

CMD.Execute

Dim StrOutput as string

strOutput = cmd.Parameters("@OutputParameterNameHere").Value

Try that and see if it works

Let us know if it doesnt!!

Peter
0
 
LVL 1

Assisted Solution

by:mahesh_mp
mahesh_mp earned 41 total points
ID: 9640909
hello maniking
this is a simple code for paramete for stored proc

  Dim cmd As New Command
  Dim strFirstArg As New Parameter
  Dim intSecondArg As New Parameter
 
  cmd.CommandText = "yourProcedure"
  cmd.CommandType = adCmdStoredProc
 
  Set strFirstArg = cmd.CreateParameter("PrimaryKey", adVarChar, adParamInput, 10)
  Set intSecondArg = cmd.CreateParameter("PrimaryKey", adInteger, adParamInput, 4)
 
  cmd.Parameters.Append strFirstArg
  cmd.Parameters.Append intSecondArg
 
  strFirstArg.Value = 1 your arguments
  intSecondArg.Value = 2 your arguments
 
  cmd.ActiveConnection = dbConn
'set your recorset  rsTemp

  Set rsTemp = cmd.Execute
0
 

Author Comment

by:ManiKing
ID: 9655929
Thanx guys.
I eventually resolved it.
Later.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question