473,408 Members | 1,601 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,408 software developers and data experts.

New Row in DataTable - problem

I use Execute Reader to get a list of data and want to add to the datatable.
I got an error in the 1st row. "Specified arguement was out of the range of
valid values. Parameter name :rowindeX"
my code is listed as following :Please be kind to help me take a look. I
really don't know what's wrong it is.

Dim drRv As SqlDataReader
Dim myDatarow As DataRow
drRv = cmdRv.ExecuteReader

While drRv.Read
myDatarow = Me.dtInvCharges.NewRow()
MessageBox.Show(drRv.Item("baseamt")) <--- It can show the
correct value
intCounter += 1
With myDatarow
.Item("acctcode") = drRv.item("acctcode") <--- It got
that errors.
End With

Me.dtInvCharges.Rows.Add(myDatarow)
end while
Nov 21 '05 #1
2 1101
It looks like there is no column called 'acctcode' in the result set.

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:uR**************@TK2MSFTNGP15.phx.gbl...
I use Execute Reader to get a list of data and want to add to the
datatable.
I got an error in the 1st row. "Specified arguement was out of the range
of valid values. Parameter name :rowindeX"
my code is listed as following :Please be kind to help me take a look. I
really don't know what's wrong it is.

Dim drRv As SqlDataReader
Dim myDatarow As DataRow
drRv = cmdRv.ExecuteReader

While drRv.Read
myDatarow = Me.dtInvCharges.NewRow()
MessageBox.Show(drRv.Item("baseamt")) <--- It can show the
correct value
intCounter += 1
With myDatarow
.Item("acctcode") = drRv.item("acctcode") <--- It got
that errors.
End With

Me.dtInvCharges.Rows.Add(myDatarow)
end while

Nov 21 '05 #2
I solve my bugs,Since my datagrid is bind to the table,
(1)Me.dgCharges.Readonly = false
(2)Me.dgCharges.Enabled = True
(3) change " dim myDatarow as datarow =Me.dtInvCharges.NewRow() "

"Marina" <so*****@nospam.com> ¼¶¼g©ó¶l¥ó·s»D:eU**************@TK2MSFTNGP10.phx.g bl...
It looks like there is no column called 'acctcode' in the result set.

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:uR**************@TK2MSFTNGP15.phx.gbl...
I use Execute Reader to get a list of data and want to add to the
datatable.
I got an error in the 1st row. "Specified arguement was out of the range
of valid values. Parameter name :rowindeX"
my code is listed as following :Please be kind to help me take a look. I
really don't know what's wrong it is.

Dim drRv As SqlDataReader
Dim myDatarow As DataRow
drRv = cmdRv.ExecuteReader

While drRv.Read
myDatarow = Me.dtInvCharges.NewRow()
MessageBox.Show(drRv.Item("baseamt")) <--- It can show the
correct value
intCounter += 1
With myDatarow
.Item("acctcode") = drRv.item("acctcode") <--- It got
that errors.
End With

Me.dtInvCharges.Rows.Add(myDatarow)
end while


Nov 21 '05 #3

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

Similar topics

0
by: Emerson | last post by:
The following assumes a System.Windows.Forms.DataGrid with a System.Data.DataTable set as the DataSource. I'm programming in C# Here's my scenario I click in a cell on a DataGrid. I enter some...
5
by: Stefan Turalski \(stic\) | last post by:
Hi, I'm wondering if there is a way to send a method parametrs by ref when DataTabel is a type of this value ? I done some sort of select over DataTable columns, just by removing them froma...
4
by: Kris Rudin | last post by:
I am displaying a table of information on a web page, using an asp:table that I populate dynamically. On this page I give the user the options to group the rows by certain fields, and/or filter the...
1
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in...
3
by: Frans Bouma | last post by:
Hi, I have a serious problem with VB.NET and a DataTable derived class and I can't figure out how to solve it. I have implemented it in C# where it works perfectly, but I can't port one...
12
by: Doug Bell | last post by:
Hi, I am having problems trying to create a (temporary) DataTable from a selection from a DataGrid (dgOrders). dtOrdDetails is declared as a Public DataTable Sub is: Dim stFilter as String...
10
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
9
by: Anil Gupte | last post by:
After reading a tutorial and fiddling, I finally got this to work. I can now put two tables created with a DataTable class into a DataRelation. Phew! And it works! Dim tblSliceInfo As New...
5
by: Frank Hauptlorenz | last post by:
Hello, I recognized some days ago, that returning a DataTable blocks my WCF-Service. Is this a known bug? If I add this table to a new DataSet() and return this, it works. Thank you, Frank
9
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a routine that builds a table using different queries, different SQL Tables, and adding custom fields. It takes a while to run (20 - 45 seconds) so I wrote a thread to handle the table...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.