I have the following code...
Public Sub SelectPieceByProductID()
Try
Dim arParams(0) As SqlParameter
arParams(0) = New SqlParameter("@lProductID", lProductID)
Dim oDR As SqlDataReader =
oData.ExecuteReader(sConnectionString, CommandType.StoredProcedure,
"spSelectPieceByProductID", arParams)
If oDR.HasRows Then
Do While oDR.Read()
sPieceNumber = CType(oDR.Item("PieceNumber"),
String)
lMetalID = CType(oDR.Item("MetalID"), Long)
lTotalCount = CType(oDR.Item("TotalCount"), Long)
dTotalWeight = CType(oDR.Item("TotalWeight"),
Double)
---> lNonCenterCount =
CType(oDR.Item("NonCenterCount "), Long)
dNonCenterWeight =
CType(oDR.Item("NonCenterWeight"), Double)
dPrice = CType(oDR.Item("Price"), Double)
lMarkup = CType(oDR.Item("Markup"), Long)
bActive = CType(oDR.Item("Active"), Boolean)
bDeleted = CType(oDR.Item("Deleted"), Boolean)
Loop
End If
oDR.Close()
oDR = Nothing
oData = Nothing
Catch ex As Exception
End Try
End Sub
I am getting an "System.IndexOutOfRangeException" exception on the
marked line. All values prior to this line are being set correctly.
Anyone see the issue here? I run the query in query analyzer with the
appropriate id and it works fine.
I'm clueless.
Thanks. 1 4616
It seems that the NonCenterCount column does not exist. Perhaps the column
name is mispelled either here, or in the table definition.
"Ratman" <ja**@attis.org> wrote in message
news:df**************************@posting.google.c om... I have the following code...
Public Sub SelectPieceByProductID()
Try
Dim arParams(0) As SqlParameter
arParams(0) = New SqlParameter("@lProductID", lProductID)
Dim oDR As SqlDataReader = oData.ExecuteReader(sConnectionString, CommandType.StoredProcedure, "spSelectPieceByProductID", arParams)
If oDR.HasRows Then Do While oDR.Read() sPieceNumber = CType(oDR.Item("PieceNumber"), String) lMetalID = CType(oDR.Item("MetalID"), Long) lTotalCount = CType(oDR.Item("TotalCount"), Long) dTotalWeight = CType(oDR.Item("TotalWeight"), Double) ---> lNonCenterCount = CType(oDR.Item("NonCenterCount "), Long) dNonCenterWeight = CType(oDR.Item("NonCenterWeight"), Double) dPrice = CType(oDR.Item("Price"), Double) lMarkup = CType(oDR.Item("Markup"), Long) bActive = CType(oDR.Item("Active"), Boolean) bDeleted = CType(oDR.Item("Deleted"), Boolean) Loop End If
oDR.Close()
oDR = Nothing oData = Nothing
Catch ex As Exception
End Try
End Sub
I am getting an "System.IndexOutOfRangeException" exception on the marked line. All values prior to this line are being set correctly. Anyone see the issue here? I run the query in query analyzer with the appropriate id and it works fine.
I'm clueless.
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: William McIlroy |
last post by:
Array Bounds Exception inside system.xml.dll. Test data is a dozen GB (available for the asking on CD). Source code follows. Call into system.xml.dll happens at the while statement..
using...
|
by: Juan Galdeano |
last post by:
Hi,
I'm working on an ONIX project and when I try to validate or read XML
files C# gives me this exception:
System.IndexOutOfRangeException
at System.Xml.XmlScanner.ScanDtdContent()
at...
|
by: Tylius |
last post by:
This one line is causing the issue, I've searched all over the net, but I
can't seem to figure out why
public static void Main(string args)
{
Console.WriteLine("Dice Roller");
try
{
int...
|
by: Stephen.Haeney |
last post by:
I have a datagrid bound to a strongly typed custom collection. I have
a Delete button on my form that calls the following code:
if ( this.BindingContext.Count > 0 )
{
myDataSource.RemoveAt(...
|
by: |
last post by:
Using the following against a sql database, I get a
system.IndexOutOfRangeException for the column name Add_Date which is valid
field name and is a datetime field. All the other columns work ok. ...
|
by: Robert Batt |
last post by:
Hello,
I have a problem deleting from a datagrid bound to a dataset. then datagrid is bound as follows
MyDatagrid.DataSource = Mydataset.Tables(strtable
this works fine for adding and...
|
by: Michael Primeaux |
last post by:
I have a simple .NET 2.0 web service created with VS.NET 2005 with a single
web method with the following signature:
void HelloWorld(Guid parameter1);
When calling this method I receive the...
|
by: Susan |
last post by:
I have an issue with the System.Collections.Generic.List that I can't
find anywhere else...
My website suddenly starts giving off System.IndexOutOfRangeException:
Index was outside the bounds of...
|
by: Mike |
last post by:
Hi,
I have a collection object bound to a data grid, after I remove an
item from the collection, the minute I click on the datagrid I get an
error saying the specified argument was out of the...
|
by: =?Utf-8?B?aW1yYW4uYQ==?= |
last post by:
Hi all,
I am having a problem with inserting rows in to my datagridview control. The
datagridview is bound to a bindingsource with a filter set. If i try and add
a row to the datagridview while...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |