Parameters type doesn't match cached parameters.

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
10/21/2008 7:28:40 AM
Gravatar
Total Posts 8

Parameters type doesn't match cached parameters.

Hi Joe,

Every other time, i try to insert or update anything in the database i get this message.

 

<img src="http://img521.imageshack.us/my.php?image=mojoportalcachedparamercr7.jpg" />

After the message, the record is stored correctly..

The types at DBHOUSE.Update()  match with my table.

 

MSSQL table  hm_HOUSE table design:

hou_id int
hou_title varchar(512)
hou_description text
hou_price decimal(18, 2)
hou_file varchar(256)
hot_id int
show_online bit

DBHOUSE.Update function:

public static bool Update(
int hou_id,
string hou_title,
string hou_description,
decimal hou_price,
string hou_file,
int hot_id,
bool show_online)
{
SqlParameterHelper sph = new SqlParameterHelper(GetConnectionString(), "hm_HOUSE_Update", 7);
sph.DefineSqlParameter("@hou_id", SqlDbType.Int, ParameterDirection.Input, hou_id);
sph.DefineSqlParameter("@hou_title", SqlDbType.VarChar, 512, ParameterDirection.Input, hou_title);
sph.DefineSqlParameter("@hou_description", SqlDbType.Text, ParameterDirection.Input, hou_description);
sph.DefineSqlParameter("@hou_price", SqlDbType.Decimal, ParameterDirection.Input, hou_price);
sph.DefineSqlParameter("@hou_file", SqlDbType.VarChar, 256, ParameterDirection.Input, hou_file);
sph.DefineSqlParameter("@hot_id", SqlDbType.Int, ParameterDirection.Input, hot_id);
sph.DefineSqlParameter("@show_online", SqlDbType.Bit, ParameterDirection.Input, show_online);
int rowsAffected = sph.ExecuteNonQuery();
return (rowsAffected > 0);

}

 

It seems quite alright to me... :) Would you have any thoughts on this one?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

10/21/2008 7:31:07 AM
Gravatar
Total Posts 8

Re: Parameters type doesn't match cached parameters.

The picture doesn't work:

img521.imageshack.us/img521/9495/mojoportalcachedparamercr7.jpg

 

<img src="http://img521.imageshack.us/img521/9495/mojoportalcachedparamercr7.jpg"/>

10/21/2008 7:32:26 AM
Gravatar
Total Posts 18439

Re: Parameters type doesn't match cached parameters.

Need to see your stored proc, most likely it has/expects a different number of parameters just as the error says.

Hope it helps,

Joe

10/21/2008 7:37:30 AM
Gravatar
Total Posts 8

Re: Parameters type doesn't match cached parameters.

STORED PROCEDURE [dbo].[hm_HOUSE_Update]


@hou_id int,
@hou_title varchar(512),
@hou_description text,
@hou_price decimal(18, 2),
@hou_file varchar(256),
@hot_id int,
@show_online bit


AS

UPDATE [dbo].[hm_HOUSE]

SET
[hou_title] = @hou_title,
[hou_description] = @hou_description,
[hou_price] = @hou_price,
[hou_file] = @hou_file,
[hot_id] = @hot_id,
[show_online] = @show_online

WHERE
[hou_id] = @hou_id

 

10/21/2008 7:45:05 AM
Gravatar
Total Posts 8

Re: Parameters type doesn't match cached parameters.

Thanks for looking at this one.. :)

Ii get the exact same error with another table.

10/21/2008 7:46:53 AM
Gravatar
Total Posts 18439

Re: Parameters type doesn't match cached parameters.

Did you make any changes to this procedure recently? If you make a change to the proc or the code, then you need to touch Web.config in order to recycle the app and clear the parameter cache. The first time it calls that proc it caches the params, then if you made a change without clearing the cache you may see this error. The cache even survives a rebuild, so you need to type a space in Web.config and save it to clear the cache.

Also its possible this line is the cause:

sph.DefineSqlParameter("@hou_price", SqlDbType.Decimal, ParameterDirection.Input, hou_price);

you should specify the size like this:

sph.DefineSqlParameter("@hou_price", SqlDbType.Decimal, 18, ParameterDirection.Input, hou_price);

Hope it helps,

Joe

10/21/2008 7:48:39 AM
Gravatar
Total Posts 18439

Re: Parameters type doesn't match cached parameters.

ps, this question really should have been posted in the developer forum not the bug reporting forum as it is not a mojoportal bug, its an issue/question about your own code.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.