Solved

Accessing Stored Procedure Parameters (Sequel Server 2002) from VB6

Posted on 2003-10-22
8
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iframe detection of parent window scale 20 92
Reccomended programming language for client-server applications 12 161
Query Syntax 17 50
printf performancy 11 84
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn different types of Android Layout and some basics of an Android App.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

756 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