473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Stored Procedure Parameters (text)

I have a stored procedure that takes parameter @description with datatype
set to text.
In my ASP I have the following:
..Parameters.Append
..CreateParameter("@description",adVarChar,adParam Input,255,varDesc))

I've seen other examples of SPs with adVarChar set to 1000 and up! Is this
the way it should be done or is there a matching parameter type I should be
using?

Any help appreciated.

chopper
Jul 19 '05 #1
10 7547
Chopper wrote:
I have a stored procedure that takes parameter @description with
datatype set to text.
In my ASP I have the following:
.Parameters.Append
.CreateParameter("@description",adVarChar,adParamI nput,255,varDesc))

I've seen other examples of SPs with adVarChar set to 1000 and up! Is
this the way it should be done or is there a matching parameter type
I should be using?

I've written a Stored Procedure Code Generator which is
available for download at
http://www.thrasherwebdesign.com/ind...asp&c=&a=clear

You can look up the datatype mappings at
http://www.able-consulting.com/ADODataTypeEnum.htm if you wish to continue
coding these things by hand.
HTH,
Bob Barrows.
Jul 19 '05 #2
In your database (I assume Access) you would have set the length of the text
field. That's the value to use.
"Chopper" <ch*****@despammed.com> wrote in message
news:3f*********************@news.dial.pipex.com.. .
I have a stored procedure that takes parameter @description with datatype
set to text.
In my ASP I have the following:
.Parameters.Append
.CreateParameter("@description",adVarChar,adParamI nput,255,varDesc))

I've seen other examples of SPs with adVarChar set to 1000 and up! Is this
the way it should be done or is there a matching parameter type I should be using?

Any help appreciated.

chopper

Jul 19 '05 #3

"Tom B" <sh*****@hotmail.com> wrote in message
news:eK*************@TK2MSFTNGP12.phx.gbl...
In your database (I assume Access) you would have set the length of the text field. That's the value to use.

<snip>

Thanks for your reply.
It's SQL Server 2000. The field in the database is of type 'Text' with
length 16.
I cannot find a matching type when passing the parameter using ASP which is
what I'm trying to figure out.
Jul 19 '05 #4
Length = 16 is only the data that is stored inside the row. If your total
data for the Text field is 16 characters or less, it is stored in the row.
Otherwise, a pointer is stored to the data page (out of row) that holds the
data.

Check Bob Barrows' info, or, you can use the code on David Penton's side
(he's an SQL Server MVP):
http://www.davidpenton.com/testsite/...b.command3.asp

You need to scroll down to get the point where he appends the parameter for
the Text datatype (adLongVarChar)

Cheers
Ken

"Chopper" <ch*****@despammed.com> wrote in message
news:3f*********************@news.dial.pipex.com.. .
:
: "Tom B" <sh*****@hotmail.com> wrote in message
: news:eK*************@TK2MSFTNGP12.phx.gbl...
: > In your database (I assume Access) you would have set the length of the
: text
: > field. That's the value to use.
: >
: >
: <snip>
:
: Thanks for your reply.
: It's SQL Server 2000. The field in the database is of type 'Text' with
: length 16.
: I cannot find a matching type when passing the parameter using ASP which
is
: what I'm trying to figure out.
:
:
Jul 19 '05 #5
Assuming your @description is the first parameter you can do this :

With Cmd
.activeconnection = CN
.Commandtext = strTheNameOfYourStoredProcedure
.commandtype = adcmdStoredProc
.Parameters(1) = strDescription (or .Parameters("@description") =
strDescription)
.execute ( or Set RS = .execute if you want a recordset
back)
End With

Define the rest in your stored procedure

Works fine in my sites

Meindert, MCP

"Chopper" <ch*****@despammed.com> wrote in message
news:3f*********************@news.dial.pipex.com.. .
I have a stored procedure that takes parameter @description with datatype
set to text.
In my ASP I have the following:
.Parameters.Append
.CreateParameter("@description",adVarChar,adParamI nput,255,varDesc))

I've seen other examples of SPs with adVarChar set to 1000 and up! Is this
the way it should be done or is there a matching parameter type I should be using?

Any help appreciated.

chopper

Jul 19 '05 #6

"PB4FUN" <th*********@doesnot.exist> wrote in message
news:e0****************@TK2MSFTNGP09.phx.gbl...
Assuming your @description is the first parameter you can do this :

With Cmd
.activeconnection = CN
.Commandtext = strTheNameOfYourStoredProcedure
.commandtype = adcmdStoredProc
.Parameters(1) = strDescription (or .Parameters("@description") =
strDescription)
.execute ( or Set RS = .execute if you want a recordset
back)
End With

Define the rest in your stored procedure

Works fine in my sites

Meindert, MCP


Thanks for your reply.
Any idea why it works though? Surely it will just default...or will it work
out what the options should be?

BTW, is this a top posting group? I'm not one of these people that get hung
up about the whole top/bottom stuff (unless it's a lady :) but just curious
so someone doesn't start throwing their toys out of their pram.
Jul 19 '05 #7
No idea why this works as well.
But I know its a lot easier programming than the .CreateParameter stuff.

Meindert, MCP
Assuming your @description is the first parameter you can do this :

With Cmd
.activeconnection = CN
.Commandtext = strTheNameOfYourStoredProcedure
.commandtype = adcmdStoredProc
.Parameters(1) = strDescription (or .Parameters("@description") = strDescription)
.execute ( or Set RS = .execute if you want a recordset back)
End With

Define the rest in your stored procedure

Works fine in my sites

Meindert, MCP
Thanks for your reply.
Any idea why it works though? Surely it will just default...or will it

work out what the options should be?

BTW, is this a top posting group? I'm not one of these people that get hung up about the whole top/bottom stuff (unless it's a lady :) but just curious so someone doesn't start throwing their toys out of their pram.

Jul 19 '05 #8
Along the same lines, without a Command object you can do

Set RS=ConnectionObject("exec strTheNameOfYourStoredProcedure '" &
strDescription & "'")
or
Set RS=ConnectionObject.strTheNameOfYourStoredProcedur e(strDescription)

Beware of SQL Injection though.
"PB4FUN" <th*********@doesnot.exist> wrote in message
news:e0****************@TK2MSFTNGP09.phx.gbl...
Assuming your @description is the first parameter you can do this :

With Cmd
.activeconnection = CN
.Commandtext = strTheNameOfYourStoredProcedure
.commandtype = adcmdStoredProc
.Parameters(1) = strDescription (or .Parameters("@description") =
strDescription)
.execute ( or Set RS = .execute if you want a recordset
back)
End With

Define the rest in your stored procedure

Works fine in my sites

Meindert, MCP

"Chopper" <ch*****@despammed.com> wrote in message
news:3f*********************@news.dial.pipex.com.. .
I have a stored procedure that takes parameter @description with datatype set to text.
In my ASP I have the following:
.Parameters.Append
.CreateParameter("@description",adVarChar,adParamI nput,255,varDesc))

I've seen other examples of SPs with adVarChar set to 1000 and up! Is this the way it should be done or is there a matching parameter type I should

be
using?

Any help appreciated.

chopper


Jul 19 '05 #9

"Tom B" <sh*****@hotmail.com> wrote in message
news:uM*************@TK2MSFTNGP12.phx.gbl...
Along the same lines, without a Command object you can do

Set RS=ConnectionObject("exec strTheNameOfYourStoredProcedure '" &
strDescription & "'")
or
Set RS=ConnectionObject.strTheNameOfYourStoredProcedur e(strDescription)

Beware of SQL Injection though.


Thanks all. Will try your suggestions out this afternoon.
Jul 19 '05 #10
> "Tom B" <sh*****@hotmail.com> wrote in message
news:uM*************@TK2MSFTNGP12.phx.gbl...
Along the same lines, without a Command object you can do

Set RS=ConnectionObject("exec strTheNameOfYourStoredProcedure '" &
strDescription & "'")
or
Set RS=ConnectionObject.strTheNameOfYourStoredProcedur e(strDescription)

Beware of SQL Injection though.


Thanks all. Will try your suggestions out this afternoon.


Only just got round to doing it. This is what I did:

In the SP:
@description text

In the ASP:
..Parameters.Append
..CreateParameter("@description",adLongVarChar,adP aramInput,len(varDesc),varD
esc)

I think this is the best way as you are specifying the length of data you
are passing. I would assume that the more explicit you are, the better the
performance would be as you are leaving less for the interpreter to guess or
work out for itself.

Any feedback, comments or criticism is welcome.

Thanks.

chopper
Jul 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
2
by: Gaab | last post by:
Hi Folks, I've created a stored procedure (Incident_Add) and called it, but when I excecute it in the code it says: "System.Data.SqlClient.SqlException: Line 1: incorrect syntax at...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
3
by: Bilbo | last post by:
I have a a headscratcher here: I have a form that when submitted should do 2 things when a user enters data and then clicks the Add button. Here goes: 1. Call a stored procedure called...
9
by: joun | last post by:
Hi all, i'm using this code to insert records into an Access table from asp.net, using a stored procedure, called qry_InsertData: PARAMETERS Long, Long, Text(20), Long, DateTime; INSERT...
6
by: SandySears | last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB and SQL Server Express. The code runs without errors or exceptions, and returns the new identifer in the output...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
5
by: ric_deez | last post by:
Hi there, I would like to create a simple search form to allow users to search for a job number based on a number of parameters. I think I understand how to use parameteres associated with Stored...
9
by: jyothi1105 | last post by:
Hi all, Here is some information which could help people who want to create stored procedures and execute them in their program. You can create stored procedures in two ways: Through front end...
1
by: sweatha | last post by:
Hi I have created a stored procedure for registration form as SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.