Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0VB and SQL Parameters; Parameter count does not match Parameter Value countVB and SQL Parameters; Parameter count does not match Parameter Value count
Previous
 
Next
New Post
4/8/2009 4:37 PM
 

I am building a module that uses gridview and formview to display data in a grid, using VB as my backend, developing in VS2008.

When I try to implement the module, I receive an error about matching parameters.

From what I have read, this error kicks back due to a discrepancy between the VB and the SQL stored procedures.

My query should be totally okay, but I don't know where exactly I should be looking in my visual basic...

I have five separate VB files; the view.vb file, edit.vb, settings.vb, the controller.vb, and info.vb.

I had thought that my best bet might be the controller file, but I can seem to find anything that might be missing.

Error report to follow:

Parameter count does not match Parameter Value count. ---> System.ArgumentException: Parameter count does not match Parameter Value count. at Microsoft.ApplicationBlocks.Data.SqlHelper.AssignParameterValues(SqlParameter[] commandParameters, Object[] parameterValues) at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, String spName, Object[] parameterValues) at MIDW.Modules.PhoneGrid.SqlDataProvider.AddPhoneGrid(Int32 ModuleId, String Content, Int32 UserId) at MIDW.Modules.PhoneGrid.PhoneGridController.AddPhoneGrid(PhoneGridInfo objPhoneGrid) at MIDW.Modules.PhoneGrid.ViewPhoneGrid.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace ---

 
New Post
4/8/2009 5:05 PM
 

From looking at the stack trace, it looks like the error is originating in the MIDW.Modules.PhoneGrid.SqlDataProvider.AddPhoneGrid method.  This is probably where you can calling the SQL stored procedure.

Hope that helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/8/2009 5:51 PM
 

Hmm... that certainly could be the case.

I had no small amount of trouble getting the query to complete successfully, but I had though I finally had it down.
I used the Host -> SQL tool, with "Run as script" checked.  It completed successfully, and everything *should* be there.
The script I wrote was one that I modified from the script that is automatically generated when you follow these directions.
I kept just about everything as it was, and added the fields that I needed.
I then did likewise for the VB, with some help from Mr. Washington's tutorial for the funtionality.
(N.B.  I do *not* want to use Linq to achieve my result)
If you have any suggestions, they are certainly appreciated.
SQL script to follow...
(omitted segments for readability)

 



/** Create Stored Procedures **/


create procedure {databaseOwner}{objectQualifier}MIDW_GetPhoneGrids

	@ModuleId int

as

select
ModuleId, ItemId, Content, CreatedByUser, CreatedDate, EmpName, Terminal, EmpNumber, ExtNumber from {objectQualifier}MIDW_PhoneGrid with (nolock) left outer join {objectQualifier}Users on {objectQualifier}MIDW_PhoneGrid.CreatedByUser = {objectQualifier}Users.UserId where ModuleId = @ModuleId GO create procedure {databaseOwner}{objectQualifier}MIDW_GetPhoneGrid @ModuleId int, @ItemId int

as

select
ModuleId, ItemId, Content, CreatedByUser, CreatedDate, EmpName, Terminal, EmpNumber, ExtNumber from {objectQualifier}MIDW_PhoneGrid with (nolock) left outer join {objectQualifier}Users on {objectQualifier}MIDW_PhoneGrid.CreatedByUser = {objectQualifier}Users.UserId where ModuleId = @ModuleId and ItemId = @ItemId GO create procedure {databaseOwner}{objectQualifier}MIDW_AddPhoneGrid @ModuleId int, @Content ntext, @UserID int, @EmpName nvarchar (55), @Terminal nvarchar (25), @EmpNumber nvarchar (25), @ExtNumber nvarchar (25) as

insert into
{objectQualifier}MIDW_PhoneGrid ( ModuleId, Content, CreatedByUser, CreatedDate, EmpName, Terminal, EmpNumber, ExtNumber ) values ( @ModuleId, @Content, @UserID, @EmpName, @Terminal, @EmpNumber, @ExtNumber, getdate() ) GO create procedure {databaseOwner}{objectQualifier}MIDW_UpdatePhoneGrid @ModuleId int, @ItemId int, @Content ntext, @UserID int, @EmpName nvarchar (55), @Terminal nvarchar (25), @EmpNumber nvarchar (25), @ExtNumber nvarchar (25) as

update
{objectQualifier}MIDW_PhoneGrid set Content = @Content, CreatedByUser = @UserID, CreatedDate = getdate(), EmpName = @EmpName, Terminal = @Terminal, EmpNumber = @EmpNumber, ExtNumber = @ExtNumber where ModuleId = @ModuleId and ItemId = @ItemId GO create procedure {databaseOwner}{objectQualifier}MIDW_DeletePhoneGrid @ModuleId int, @ItemId int

as

delete
from
{objectQualifier}MIDW_PhoneGrid where ModuleId = @ModuleId and ItemId = @ItemId GO
 
New Post
4/8/2009 5:55 PM
 

Do you know where that AddPhoneGrid method is in SqlDataProvider?  How many parameters are you sending in (it should be seven)?  Can you show me that code?

Hope I can help,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/8/2009 6:06 PM
 

Well, this should be the AddPhoneGrid stored procedure...
 

create procedure {databaseOwner}{objectQualifier}MIDW_AddPhoneGrid

	@ModuleId       int,
	@Content        ntext,
	@UserID         int,
	@EmpName		nvarchar (55),
	@Terminal		nvarchar (25),
	@EmpNumber		nvarchar (25),
	@ExtNumber		nvarchar (25)

as

insert into
{objectQualifier}MIDW_PhoneGrid ( ModuleId, Content, CreatedByUser, CreatedDate, EmpName, Terminal, EmpNumber, ExtNumber ) values ( @ModuleId, @Content, @UserID, @EmpName, @Terminal, @EmpNumber, @ExtNumber, getdate() ) GO

 

And I would be more than happy to show you that code...
The problem is that I am not sure where to find the code that is sending the parameters.
This is partially because I am not very experienced, and partially because I used the pre-generated module.
In which of my five vb files should I look?
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0VB and SQL Parameters; Parameter count does not match Parameter Value countVB and SQL Parameters; Parameter count does not match Parameter Value count


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out