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
Solved

Stored Procedure Expects Parameter

Posted on 2002-05-17
19
326 Views
Last Modified: 2010-05-02
My program works on my computer and another programmer's computer, but it fails at the clients site with the message "Procedure SpecialtyCheck expects parameter @Specialty which was not supplied."

I'm executing the stored procedure with a command and like I said it works on the computers in our office, but not on site.

The specialty comes from an Excel spreadsheet, but I received this from the client so I know we are reading the same data to import.

Thanks,
Joe
0
Comment
Question by:Joe46
  • 6
  • 5
  • 3
  • +4
19 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7016226
can you post the stored procedures' header, and also the sample command line?
CHeers
0
 

Author Comment

by:Joe46
ID: 7016242
Dim intResult As Integer     'Return value
Dim cmdCheck As ADODB.Command
Dim params1 As ADODB.Parameters
   
' Create connection and command objects
Set cmdCheck = New ADODB.Command
   
' Set command properties
Set cmdCheck.ActiveConnection = db
cmdCheck.CommandText = "SpecialtyCheck"
cmdCheck.CommandType = adCmdStoredProc
Set params1 = cmdCheck.Parameters

' Refresh parameters from database
params1.Refresh

' Specify input parameter values
'This value comes from the spreadsheet
params1("@Specialty") = cmdSpecialtyCode.Parameters("InSpecialtyDesc").Value

' Execute the command
cmdCheck.Execute , , adExecuteNoRecords

' Retrieve stored procedure return value
intResult = params1("RETURN_VALUE")


intResult will be a "1" if it is in the table and a "0" if it is not.
0
 
LVL 1

Expert Comment

by:ndb
ID: 7016253
Can you also give the content of the stored procedure?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:Joe46
ID: 7016261
This is the stored procedure.


CREATE PROCEDURE SpecialtyCheck
@Specialty varchar(100)
 AS
 
Begin
  If Exists(SELECT Specialty FROM SpecialtyCodes WHERE Specialty = @Specialty)
   Return 1
Else
  Return 0
End
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7016275
I think to remember that this could work:
params1("Specialty") = ...

or this should work anyway
params1(1) = ...
and
intResult = params1(0)


Furthermore, you could do this:
CREATE PROCEDURE SpecialtyCheck
@Specialty varchar(100) = NULL
AS ...

to ensure that even if no (empty) value is supplied the proc will be happy to execute...

CHeers



0
 
LVL 4

Expert Comment

by:Steve Sirica
ID: 7016370
I just checked some code of mine that uses commands and parameters and it doesn' look like you appending the parameter to the command object.  Here is a working snippet of code that I use:


dim adoPara          As ADODB.Parameter
dim adoComm          As ADODB.Command

adoComm.CommandType = adCmdStoredProc
adoComm.CommandText = strProc

Set adoPara = New ADODB.Parameter
adoPara.Name = "P1"
adoPara.Type = adVarChar
adoPara.Direction = adParamInput
adoPara.Size = Len("Some Value")
adoPara.Value = "some value"
adoComm.Parameters.Append adoPara

Hope that helps good luck
Steve
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7016373
SSirica:
the line "params1.Refresh" does all this automatically, at the cost of a network trip.
CHeers

0
 
LVL 4

Expert Comment

by:Steve Sirica
ID: 7016399
OK.  I noticed it was different than the code I was using, so I thought I'd give it a shot.

Steve
0
 

Author Comment

by:Joe46
ID: 7016433
Since the code works on the computers in our office I was thinking they have something different on their end, but I have no idea what that could be.

Thanks,
Joe
0
 
LVL 4

Expert Comment

by:Steve Sirica
ID: 7016455
Are they getting any errors?  Could this be as simple as ADO versions being out of synch?
0
 
LVL 5

Expert Comment

by:bob_online
ID: 7016578
Have you verified the store procedure at their location is the same?
0
 

Author Comment

by:Joe46
ID: 7016786
bob online,

I gave them the stored procedure and they did a copy and paste. Later I had them send me a screen shot of the code and it sure looks the same.

SSirica,

I will have to check to see what version of ADO they have on their computer.

Thanks,
Joe
0
 
LVL 4

Expert Comment

by:Steve Sirica
ID: 7016794
Well it's just a thought.  Do any DB calls work or are just the ones with Parms broke?
0
 
LVL 5

Expert Comment

by:bob_online
ID: 7016870
Be careful when asking the client about the stored procedure.  So they did a copy and paste?  Did they compile it?  Where did they paste it?  In a source code file?  See my point?
0
 

Author Comment

by:Joe46
ID: 7016952
bob online,

The SP is in SQL Server 7. They have placed it in the correct place because I had them send me a screen shot of that too.

Thanks,
Joe
0
 

Author Comment

by:Joe46
ID: 7017112
SSirica,

I thought you might be on to something when they told me they are using ADO 2.5 and I'm using 2.6. But then the other computer in the office where it works is also using 2.5.

Oh well, thanks anyway.

Joe
0
 
LVL 4

Expert Comment

by:Steve Sirica
ID: 7017143
Well you still may not be out of the woods.  I don't think it's a 2.6 vs. a 2.6 issue.  I'm sure it will work fine using either.  What I was trying to get at was if the exe is compiled with a 2.6 ref and they are on 2.5 that could cause an ActiveX error.  I assume the other in house machine is developer machine and has a 2.5 ref set?  

See where I'm going?  That's why I asked if any DB calls worked at all.

Steve
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7817810
Hi Joe46,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

Joe46, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7909709
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to open Waze.com/livemap from address saved in DB? 26 207
VBA saving file message display 5 72
Best way to parse out a json string in VB6? 10 218
MsgBox 4 68
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

808 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