473,396 Members | 2,061 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,396 software developers and data experts.

out of range erxception

19
I'm having out of range exception when executing the line
Expand|Select|Wrap|Line Numbers
  1. rdr_mfdby = rdr(" Mfd_company").ToString
  2.  
  3.  
FYI giving the code below.
Expand|Select|Wrap|Line Numbers
  1.  
  2.   Private Sub AllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AllToolStripMenuItem.Click
  3.         Dim todate = DateAndTime.Now.Date
  4.         If con.State = ConnectionState.Closed Then
  5.             con.Open()
  6.         End If
  7.         Dim cmd As OleDbCommand = New OleDbCommand("Select In_date, product_name, Batch_no, pack, Mfd_company from Inward_Entry", con)
  8.         Dim rdr As OleDbDataReader
  9.         rdr = cmd.ExecuteReader
  10.         Dim dt As DataTable = New DataTable
  11.         Try
  12.             Dim span As TimeSpan
  13.             Dim rdr_dt As Date
  14.             Dim rdr_name, rdr_batch, rdr_pack, rdr_mfdby As String
  15.            While rdr.Read()
  16.                 rdr_dt = rdr("in_date").date
  17.                 rdr_name = rdr("Product_name").ToString
  18.                 rdr_batch = rdr("Batch_no").ToString
  19.                 rdr_pack = rdr("pack").ToString
  20.                 rdr_mfdby = rdr(" Mfd_company").ToString
  21.                 span = todate.Subtract(rdr_dt)
  22.                 Dim cmd1 As OleDbCommand = New OleDbCommand("update warehouse_master set ageing = span  where product_name='" & rdr_name & "' and product_batch_no='" & rdr_batch & "' and item_pack='" & rdr_pack & "' and product_manufacturer='" & rdr_mfdby & "' ", con)
  23.                 cmd1.ExecuteNonQuery()
  24.             End While
  25.         Catch ex As Exception
  26.             MessageBox.Show(ex.ToString)
  27.         End Try
  28.         con.Close()
  29.     End Sub
  30.  
Plz help
Dec 27 '10 #1
2 1078
If it is not a typo here then the leading blank in your indexor will cause this kind of error.

(" Mfd_company") must be ("Mfd_company").
Dec 27 '10 #2
GR M
19
I'v done it myself. Bt thanks a lot for your time and support
Dec 28 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Xah Lee | last post by:
Today we'll be writing a function called Range. The Perl documentation is as follows. Perl & Python & Java Solutions will be posted in 48 hours. This is Perl-Python a-day. See...
1
by: Thomas | last post by:
Hi dudes, I have a range object for text (not the one in the IE, the one for Mozilla). Now I have a function to reduce/move the range in the text to the LEFT, e.g.:...
4
by: Bill R via AccessMonster.com | last post by:
I get this Run-Time Error 1004 whenevery the following code runs: On Error GoTo XLSheet2 Set objXL = CreateObject("Excel.Application") With objXL Set objWkb = .Workbooks.Open(strPath) With...
4
by: IMS.Rushikesh | last post by:
Hi All, I am trying to execute below code but it gives me an COMException ///// Code Start //// public string GetName(Excel.Range range) { try { if (range.Name != null)
1
by: Jeffrey Bradshaw | last post by:
Is there any way to make a copy of a word.range object? I have a range in a document and I need to monkey around with it but I don't want to change the original in the document. I've tried...
5
by: Chris | last post by:
Hey all. Anyone who is familiar with Python programming knows that you can have code like this: list = This code puts all the items processed by the for loop in a list plus 1. Is there a way...
29
by: Steve R. Hastings | last post by:
When you compile the expression for i in range(1000): pass does Python make an iterator for range(), and then generate the values on the fly? Or does Python actually allocate the list and...
3
by: toton | last post by:
Hi, I want ro iterate over a few container class within a range specified, instead of begin & end. How to construct a range class, which takes start & end, and iteration is available within that...
85
by: Russ | last post by:
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the...
0
by: iain654 | last post by:
I have finally worked out how to automatically send a range of cells in the body of an email using Outlook but it is very clumsy and I have to build up the email using the limit of line...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.