Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Stored Procedures from ASPs

Posted on 1999-07-08
7
Medium Priority
?
163 Views
Last Modified: 2013-12-24
I want to call a stored procedure with parameters from asp files. My database is on MS SQL 6.5. I am able to call a stored procedure that does not take any parameters, however when I try to call a sp with parameters I get the following error  :

"The parameter object is not defined properly".

Any answers ?
0
Comment
Question by:raghurani
[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
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:TTom
ID: 1868003
Would you post the ASP code which is generating the error?  Generally, there is additional coding required to create the parameters for a stored procedure, and it sounds like this is not being done properly.

Tom
0
 
LVL 1

Author Comment

by:raghurani
ID: 1868004
Hi Tom,

Here is what you had asked for.

-------------------------------------------
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual
Studio 6.0">
</HEAD>
<BODY>

<P>&nbsp;</P>

<%
'' Validateuser is a stored Procedure
'' which has two parameters for username & Password
'' If the Stored procedure is executed successfully
'' then "Yes" should be displayed.
''
'set myparam=createobject("ADODB.parameter")
''
set dbcon=server.CreateObject("adodb.connection")
dbcon.ConnectionString="driver={sql

server};database=appls;uid=rajani;pwd=tsa;server=KRISHNA;"
dbcon.Open

set dbcomm = server.CreateObject("ADODB.command")
dbcomm.ActiveConnection="driver={sql

server};database=appls;uid=rajani;pwd=tsa;server=KRISHNA;"

dbcomm.CommandText = "validateuser"
dbcomm.CommandType=adCmdStoredProc
''
set Myfirstparam=dbcomm.CreateParameter(
"Username",adVarChar,adParamInput)
dbcomm.Parameters.Append myFirstparam
''
set

MySecondParam=dbcomm.CreateParameter("Pswrd",adVarChar,adParamInput,8)
dbcomm.Parameters.Append MySecondParam
''
dbcomm.Parameters(1)="AA"
dbcomm.Parameters(2)="BB"
''
dbcomm.Execute

Response.write("yes")
%>

</BODY>
</HTML>
----------------------------------------------------------------
That's it.

Looking forward for your reply.

Bye and thanks,
Raghu.

0
 
LVL 9

Expert Comment

by:TTom
ID: 1868005
Raghu:

Unfortunately, haven't seen this construction for parameters previously.  However, it seems to me that you have three arguments in one of your definitions and four in the other.

I also think the syntax for your assignment of values for the parameters may be wrong.  I think it should be:

dbcomm.Parameters(1).value="AA"

In fact, for safety's sake, I would probably use:

dbcomm.Parameters("Username").value="AA"

Just some thoughts.

Question:  Does your error message identify the line where the error occurs?  If so, which definition is it?

Tom
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 1

Author Comment

by:raghurani
ID: 1868006
Tom,

it is working fine. No problem.
thanks a lot.

PS : I do not know how to select your comment
     as the answer. Give me some time.

regards,
Raghu.

0
 
LVL 9

Accepted Solution

by:
TTom earned 150 total points
ID: 1868007
Raghu:

Actually, I need to post an answer in order for you to grade/award it.  (I and many of the other experts frequently post as comments to encourage discussion and allow a 'complete' answer to be formulated before closing out a question.)

If that is the case, you just need to request an answer from whomever you wish to award points, and they will surely respond.

Thanks,

Tom

P.S.  Time is no problem.  At your convenience. (:-}
0
 
LVL 1

Author Comment

by:raghurani
ID: 1868008
Tom,

your answer was of good help to me.
can you let me know how to use the "in"
and "out" parameters for a stored procedure
with a simple example ?

0
 
LVL 9

Expert Comment

by:TTom
ID: 1868009
Raghu:

I assume you are speaking of the Input/Output or Parameter 'Direction' property.  If that is so, I am not really familiar with using the 'out' direction.  The 'in' simply defines the parameter as being supplied to the query.

I would suggest you look up the Visual InterDev mailing list (vi6talk@listbot.com) and pose the question there.  The inhabitants of that list (I lurk a lot) are quite knowledgable and will probably be able to supply better info than I.

Tom
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

730 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