473,503 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Too many arguments error

Roy
Hey all,
Perhaps one of you can see what I'm doing wrong. The rowselectorcolumn
is an excellent little control that adds in checkboxes to a datagrid.
That's just an FYI, it's not my problem. If I click "btnRelease" and
only have a single checkbox checked, all is well and the records update.
If I click multiple checkboxes and click "btnRelease" the code bombs out
with a "Too many arguments" error. It's as if the For Each isn't
processing each record individually. Make sense?

Sub Record(ByVal sender As Object, ByVal e As EventArgs) Handles
btnRelease.Click

Dim rsc As MetaBuilders.WebControls.RowSelectorColumn =
MetaBuilders.WebControls.RowSelectorColumn.FindCol umn(MyDataGrid)

Dim selIndex As Integer
Dim tmp As Integer = 0
Dim myCommand As SqlCommand = New SqlCommand("RPT_Released",
localConnection)
localConnection.Open()

For Each selIndex In rsc.SelectedIndexes
With myCommand
.CommandType = CommandType.StoredProcedure
.CommandTimeout = "9999"
.Parameters.Add(New SqlParameter("@vdn", SqlDbType.VarChar, 5)).Value =
MyDataGrid.Items(selIndex).Cells(2).Text
.Parameters.Add(New SqlParameter("@Shipper", SqlDbType.VarChar,
19)).Value = gShipper.Trim
.Parameters.Add(New SqlParameter("@dodaac", SqlDbType.VarChar, 6)).Value
= gDodaac.Trim
.Parameters.Add(New SqlParameter("@carrier", SqlDbType.VarChar,
4)).Value = gCarrier.Trim
.Parameters.Add(New SqlParameter("@pod", SqlDbType.VarChar, 3)).Value =
gPOD.Trim
.Parameters.Add(New SqlParameter("@ship", SqlDbType.VarChar, 30)).Value
= MyDataGrid.Items(selIndex).Cells(4).Text
.Parameters.Add(New SqlParameter("@sdate", SqlDbType.NVarChar,
10)).Value = MyDataGrid.Items(selIndex).Cells(5).Text
End With

'Code bombs out on the next line below
myCommand.ExecuteNonQuery()
Next

localConnection.Close()
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
1 976
On Fri, 30 Sep 2005 10:53:22 -0700, Roy wrote:
Hey all,
Perhaps one of you can see what I'm doing wrong. The rowselectorcolumn
is an excellent little control that adds in checkboxes to a datagrid.
That's just an FYI, it's not my problem. If I click "btnRelease" and
only have a single checkbox checked, all is well and the records update.
If I click multiple checkboxes and click "btnRelease" the code bombs out
with a "Too many arguments" error. It's as if the For Each isn't
processing each record individually. Make sense?

Sub Record(ByVal sender As Object, ByVal e As EventArgs) Handles
btnRelease.Click

Dim rsc As MetaBuilders.WebControls.RowSelectorColumn =
MetaBuilders.WebControls.RowSelectorColumn.FindCol umn(MyDataGrid)

Dim selIndex As Integer
Dim tmp As Integer = 0
Dim myCommand As SqlCommand = New SqlCommand("RPT_Released",
localConnection)
localConnection.Open()

For Each selIndex In rsc.SelectedIndexes
With myCommand
.CommandType = CommandType.StoredProcedure
.CommandTimeout = "9999"
.Parameters.Add(New SqlParameter("@vdn", SqlDbType.VarChar, 5)).Value =
MyDataGrid.Items(selIndex).Cells(2).Text
.Parameters.Add(New SqlParameter("@Shipper", SqlDbType.VarChar,
19)).Value = gShipper.Trim
.Parameters.Add(New SqlParameter("@dodaac", SqlDbType.VarChar, 6)).Value
= gDodaac.Trim
.Parameters.Add(New SqlParameter("@carrier", SqlDbType.VarChar,
4)).Value = gCarrier.Trim
.Parameters.Add(New SqlParameter("@pod", SqlDbType.VarChar, 3)).Value =
gPOD.Trim
.Parameters.Add(New SqlParameter("@ship", SqlDbType.VarChar, 30)).Value
= MyDataGrid.Items(selIndex).Cells(4).Text
.Parameters.Add(New SqlParameter("@sdate", SqlDbType.NVarChar,
10)).Value = MyDataGrid.Items(selIndex).Cells(5).Text
End With

'Code bombs out on the next line below
myCommand.ExecuteNonQuery()
Next

localConnection.Close()
End Sub

*** Sent via Developersdex http://www.developersdex.com ***

It sounds like the stored procedure is complaining.

Nov 19 '05 #2

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

Similar topics

9
2415
by: Chuck Anderson | last post by:
I have a function with 7 inputs. The last three have default values. I want to call that function specifying the first four, skip two and then specify the last. I thought I could write this...
2
8187
by: Steven D'Aprano | last post by:
I'm trying to keep an open mind, but I am perplexed about something in Python that strikes me as a poor design. py> def func(a,b): py> print a,b py> func(1) Traceback (most recent call...
4
6206
by: Martin Magnusson | last post by:
I'm using a matrix and vector library, that won't compile. When running g++ I get the error message "macro "minor" passed 5 arguments, but takes just 1" The definition of "minor" looks like...
6
4000
by: Melkor Ainur | last post by:
Hello, I'm attempting to build an interpreter for a pascal-like language. Currently, I don't generate any assembly. Instead, I just build an abstract syntax tree representing what I've parsed...
41
2498
by: Telmo Costa | last post by:
Hi. I have the following code: -------------------------------------- function Tunnel() { //arguments(???); } function Sum() { var sum = 0; for (i=0; i<arguments.length; i++) sum +=...
36
2657
by: Pacific Fox | last post by:
Hi all, haven't posted to this group before, but got an issue I can't work out... and hoping to get some help here ;-) I've got a base object that works fine with named arguments when called...
2
2854
by: Spoon | last post by:
Hello everyone, AFAIU, in C89, calling fprintf with too few arguments leads to UB. 4.9.6.1 The fprintf function Synopsis #include <stdio.h> int fprintf(FILE *stream, const char *format,...
2
12496
ADezii
by: ADezii | last post by:
When a call is made to a Sub or Function Procedure, you can supply Arguments in the exact order they appear in the Procedure's definition, or you can supply them in any position by name. To...
18
2565
by: squaretriangle | last post by:
Is it possible through some trickery, perhaps using the methods of stdarg, to pass a dynamic (unknown at compile time) number of arguments to a function? For example, I want to enumerate an array...
0
1027
by: M.-A. Lemburg | last post by:
On 2008-10-31 00:18, John Krukoff wrote: The (n given) notice refers to the number of keyword parameters you specified in the call that could be associated with a non-keyword arguments of the...
0
7203
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
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7281
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
7334
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
7462
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...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.