473,809 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.IndexOut OfRangeExceptio n: 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="txtFirstNam e" 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 2012
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***@discussi ons.microsoft.c om> wrote in message
news:7D******** *************** ***********@mic rosoft.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.IndexOut OfRangeExceptio n: 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="txtFirstNam e" 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
3043
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 example dsParts.xsd and including that in the data tier. I then will create a class that looks like this Public Class CPart Inherits dsParts
0
1120
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 they so desire. My dilemma is this:
0
1689
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 every where I can think and I can not find the solution. The closest I can come is to implement IBindingList or IListSource to expose a list for the DataSource property on controls. This works great for controls like a list box but doesn't work...
2
2904
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, AddresseInfoID) 2. AddresseInfo (ID, Street, City, Zip) (Those two obviously have a relationship)
6
1337
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 web service, however when I bind the data I get the following error **** DataBinder.Eval: 'UserServices.User' does not contain a property with the name FirstName. **** Debugging I see that the list controls data source is a System.Array with...
6
14001
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 and error 'Object reference not set to an instance of an object.' as soon as I try to access the data in the fields, I.e. at the line that reads 'KeyFlags(i) = rstFields("keyflag").value'
2
4915
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 TextBoxes) works fine the first time round. I can see, edit and update the details from my form, then close the form. I then like to select and refill the datatable with a different record (new
1
2102
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 DataSource property to the BindingSource control, which the Data Source Configuration Wizard created for me. The data binding works fine when I run the app, but I can't get a reference to the DataGridView's data bindings.
0
9602
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10639
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10120
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7661
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.