Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- From: Lars-Erik <lars-erik@xxxxxxxxxxxxxxxx>
- Date: Wed, 14 May 2008 05:59:01 -0700
Hi again!
Thanks for the bad-practice recommendations, I'm all with you. (I'm
currently MCTS for web and very updated on best practices with ADO.NET)
But to my defence this is a six year old legacy application running in a
sheltered environment with a very limited amount of users, and I'm not about
to rewrite it for free in ASP 3.0. ;)
The "runCommand" function is always called with an initialized and open
connection.
One of the procedures that works and has 5 parameters after .Refresh looks
like this:
CREATE PROCEDURE [dbo].[UpdateSkiftTid]
@SkiftID Integer,
@LinjeID Integer,
@SkiftStart DateTime,
@SkiftStopp DateTime
AS
....
One of the ones that does not work (0 parameters after .Refresh) looks like
this:
CREATE PROCEDURE [dbo].[UpdateNormverdier]
@LinjeID as int,
@GradID as int,
@AntallSkift as int,
@Stopptid as int,
@AntallProd as int,
@AntallStopp as int
AS
....
None of them has any explicit return value, but as I recall, .Refresh
creates one anyway. (And the 5 returned parameters imply..)
I've tried SQL Server Native and SQL Server using ODBC via ODBC dsn's, and
I've also tried using a connection string with Provider=SQLOLEDB.1.
--
Lars-Erik
"Bob Barrows [MVP]" wrote:
Lars-Erik wrote:.
Hi!
The code I provided doesn't show, but after the connection, command
type and command text are set I also call
oCmd.Parameters.Refresh
I've done a little testing at the customers server, and it seems that
Refresh fills the parameters for some, but not all of the stored
procedures.
Any way to fix it?
I don't know, and now I'm really glad I never use it.
It might help to show the beginning of the CREATE PROCEDURE script for one
of the procedures for which Refresh does not work. We just need to see the
part where the parameters are declared
create procedure myprocedure (
@parm1 int, ..., @parmN varchar(5)) AS
You're not using any SQL2005-specific datatypes are you? Are you using the
native client provider to connect to SQL 2005?
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
- Follow-Ups:
- Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- From: Bob Barrows [MVP]
- Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- References:
- Non initialized Cmd Parameter Collection via ASP vs SQL Server 200
- From: Lars-Erik
- RE: Non initialized Cmd Parameter Collection via ASP vs SQL Server 200
- From: Steven Cheng [MSFT]
- RE: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- From: Lars-Erik
- Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- From: Bob Barrows [MVP]
- Non initialized Cmd Parameter Collection via ASP vs SQL Server 200
- Prev by Date: Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- Next by Date: Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- Previous by thread: Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- Next by thread: Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server
- Index(es):
Relevant Pages
|
Loading