Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to retrieve data from a row in a dataset

Posted on 2006-11-14
3
Medium Priority
?
227 Views
Last Modified: 2010-04-17
Server Error in '/ItemQuotes' Application.

--------------------------------------------------------------------------------

There is no row at position 6.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: There is no row at position 6.

Source Error:

 
Line 109:                          if (cnt > 0)
Line 110:                          {
Line 111:                                   txtProductId.Text = Convert.ToString(dsproductvendorList.Tables[0].Rows[rowcount]["id"]);
Line 112:                                   txtVendorName.Text = Convert.ToString(dsproductvendorList.Tables[0].Rows[rowcount]["vendor_name"]);
Line 113:                                   txtKISDVendorNumber.Text = Convert.ToString(dsproductvendorList.Tables[0].Rows[rowcount]["KISD_vendor_number"]);
 


Source File: c:\inetpub\wwwroot\itemquotes\productvendor_tb_edit.aspx.cs    Line: 111

Stack Trace:

 
[IndexOutOfRangeException: There is no row at position 6.]
   System.Data.DataRowCollection.get_Item(Int32 index)
   ItemQuotes.Productvendor_Tb_Edit.itemsDataBind() in c:\inetpub\wwwroot\itemquotes\productvendor_tb_edit.aspx.cs:111
   ItemQuotes.Productvendor_Tb_Edit.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\itemquotes\productvendor_tb_edit.aspx.cs:55
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()
 

 


--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
0
Comment
Question by:kwcowboy1226
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
riyazthad earned 2000 total points
ID: 17943112
you may try to retrive row which are out of range.

dsproductvendorList.Tables[0].Rows[rowcount]["id"])

check value of rowcount and make sure there is data in that row.

0
 

Expert Comment

by:Michelle_Pitter
ID: 17949211
I'm not sure if this is going to help but I had the same sort of error and it was all down to the fact that i forgot to set a primary key up in the database table the data was stored in.
0
 
LVL 6

Expert Comment

by:riyazthad
ID: 17956036
could you solve?
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question