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

Data binding at design time. How to work with them. I got error me

MY purpose is that develop a web form with textboxes to display database
contents.
In design time, I follow the .Net document and click data binding property
field in each TextBox, select the corresponding colunm name of database table
to each textbox.

In the Page_Load procedure, I type me.databind().
Compiling is OK. When I run it, I got the following error message.
Did I do any thing wrong? How to do it?

Thank you for your help.

David

System.IndexOutOfRangeException: Index 0 is not non-negative and below total
rows count.

Source Error:
Line 11: <body MS_POSITIONING="GridLayout">
Line 12: <form id="Form1" method="post" runat="server">
Line 13: <asp:TextBox id="txtFirstName" style="Z-INDEX: 101; LEFT: 216px;
POSITION: absolute; TOP: 184px"
Line 14: runat="server" Width="200px" Text='<%#
DataBinder.Eval(dsPatients, "Tables[Patients].DefaultView.[0].FirstName") %>'>
Line 15: </asp:TextBox>

Nov 19 '05 #1
1 1998
David,

I'm not sure what database type you're using, but you'll want to double
check to make sure whatever method you're using (Query or Stored Procedure)
is actually returning data. You have it hard coded to put data from row 0
into the textbox.
I wouldn't suggest ever hardcoding a specific row's value to a field unless
that page will always return a single row no matter what.

Either way, double check your data, that seems to be the culprit.

-Jeff

"david" <da***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
MY purpose is that develop a web form with textboxes to display database
contents.
In design time, I follow the .Net document and click data binding property
field in each TextBox, select the corresponding colunm name of database
table
to each textbox.

In the Page_Load procedure, I type me.databind().
Compiling is OK. When I run it, I got the following error message.
Did I do any thing wrong? How to do it?

Thank you for your help.

David

System.IndexOutOfRangeException: Index 0 is not non-negative and below
total
rows count.

Source Error:
Line 11: <body MS_POSITIONING="GridLayout">
Line 12: <form id="Form1" method="post" runat="server">
Line 13: <asp:TextBox id="txtFirstName" style="Z-INDEX: 101; LEFT: 216px;
POSITION: absolute; TOP: 184px"
Line 14: runat="server" Width="200px" Text='<%#
DataBinder.Eval(dsPatients, "Tables[Patients].DefaultView.[0].FirstName")
%>'>
Line 15: </asp:TextBox>

Nov 19 '05 #2

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

Similar topics

16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
0
by: PCC | last post by:
I am writing an ASP.NET web application and I control all the tiers. I need to return all results from the Web Service mid-tier as XML so other people can use our business objects in the future if...
0
by: Jason | last post by:
What interface do I need to implement in order to get a component with a public property to show up in the data binding drop down boxes at design time in VS.net? I've tried to look just about...
2
by: Matthias S. | last post by:
Hi, I have to write an application which extensively uses an SQL Database. For a simple example say I have the following tables with the appropriate fields. 1. Company (ID, Name,...
6
by: Brad | last post by:
I have a web service which returns a collection of class object (see below). I want to consume this service in another web application by binding it to a List control The data returns from the...
6
by: Andy Barber | last post by:
Hi, I'm trying to write an app that reads data from a table into a string variable for later use in my program. Below is a snippet of the code I'm using, which compiles ok, but at runtime I get...
2
by: Matthias | last post by:
Hi Team this may be a newbie question. I have searched the discussions before posting: I'd like to re-use a form instance to edit record details. My data binding (a DataTable bound to...
1
by: David Veeneman | last post by:
How do I get the data bindings for a control that is bound at design time? I'm binding a DataGridView control to a data source at design time, using a BindingSource control. I set the grid's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...
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
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...

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.