邦定技术在线,数据邦定问题

数据邦定问题 - 故障解答 - 电脑教程网

数据邦定问题

日期:2007-10-07   荐:
数据邦定问题我做了一个页面,DataGrid邦定数据正常后,原来有添加了”选择列“,可我刚把“选择列”删除后就整个DataGrid都没有显示出来了,请问这个是什么原因?你是不是不小心把AutoGenerateColumn设置成false了?把你的datagrid的代码贴出来看看吧一定是你同时也删除了其它的内容了..<%@ Page language="c#" Codebehind="customer.aspx.cs" AutoEventWireup="false" Inherits="升日财务管理软件.baseinfo.customer" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML><HEAD><title>customer</title><meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"><meta name="CODE_LANGUAGE" Content="C#"><meta name="vs_defaultClientScript" content="JavaScript"><meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"></HEAD><body><form id="Form1" method="post" runat="server"><P><FONT face="宋体">客户列表 </FONT></P><P><asp:DataGrid id="dgcustomer" runat="server" GridLines="Horizontal" CellPadding="3" BackColor="White"BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF" Width="248px"><Columns><asp:BoundColumn DataField="用户名" HeaderText="test"></asp:BoundColumn></Columns></asp:DataGrid></P><P><asp:HyperLink id="HyperLink1" runat="server" NavigateUrl="addcustomer.aspx">添加新客户</asp:HyperLink></P></form></body></HTML>using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Configuration;namespace 升日财务管理软件.baseinfo{/// <summary>/// customer 的摘要说明。/// </summary>public class customer : System.Web.UI.Page{protected System.Web.UI.WebControls.HyperLink HyperLink1;protected System.Web.UI.WebControls.DataGrid dgcustomer;private void Page_Load(object sender, System.EventArgs e){// 在此处放置用户代码以初始化页面if (!Page.IsPostBack){customerbind();}}public void customerbind(){SqlConnection myconn = new SqlConnection(ConfigurationSettings.AppSettings["ConnString"]);SqlCommand mycmd = new SqlCommand("select * from 客户资料",myconn);myconn.Open();dgcustomer.DataSource=mycmd.ExecuteReader();dgcustomer.DataBind();}#region Web 窗体设计器生成的代码override protected void OnInit(EventArgs e){//// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。//InitializeComponent();base.OnInit(e);}/// <summary>/// 设计器支持所需的方法 - 不要使用代码编辑器修改/// 此方法的内容。/// </summary>private void InitializeComponent(){ }#endregion}}似乎没有问题你确定你的数据库没有问题吧,会不会DataSet.Tables.count=0或者Rows.Count=0我晕呀,这个数据今天早上我还看到过,后来我一改代码就不行了,如果我重做一个页面这数据就能出来。
标签: