Question about displaying database details by DataView
Source: Internet
Author: User
The following problems occur when you click the link:
Index 0 is not a non-negative value and is smaller than the total number of rows.
Note: an unhandled exception occurs during the execution of the current Web request. Check the stack trace information for details about the error and the source of the error in the code.
Exception details: System. IndexOutOfRangeException: index 0 is not a non-negative number and is smaller than the total number of rows.
SOURCE error:
Row 26: <asp: Label id = "Label4" style = "Z-INDEX: 107; LEFT: 280px; POSITION: absolute; TOP: 168px" runat = "server"
Line 27: Width = "48px" Height = "32px"> Project No. </asp: Label>
Row 28: <asp: Label id = XM_NAME style = "Z-INDEX: 106; LEFT: Pixel; POSITION: absolute; TOP: export PX "runat =" server "Width =" 121px "Height =" 32px "Text = '<% # DataBinder. eval (dataView1, "[0]. XM_NAME "," {0} ") %> '>
Row 29: </asp: Label>
Row 30: <asp: TextBox id = "TextBox1" style = "Z-INDEX: 101; LEFT: 64px; POSITION: absolute; TOP: 48px" runat = "server"
Even the main source code is as follows:
Using System;
Using System. Collections;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Web;
Using System. Web. SessionState;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. UI. HtmlControls;
Namespace test8
{
/// <Summary>
/// Summary of WebForm1.
/// </Summary>
Public class WebForm1: System. Web. UI. Page
{
Protected System. Web. UI. WebControls. Label Label1;
Protected System. Web. UI. WebControls. TextBox TextBox1;
Protected System. Web. UI. WebControls. Button Button1;
Protected System. Data. OleDb. OleDbDataAdapter oleDbDataAdapter1;
Protected System. Data. OleDb. OleDbCommand oleDbSelectCommand1;
Protected System. Data. OleDb. OleDbCommand oleDbInsertCommand1;
Protected System. Data. OleDb. OleDbCommand oleDbUpdateCommand1;
Protected System. Data. OleDb. OleDbCommand oleDbDeleteCommand1;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service