ASP.NET GridView学习之五 单行编辑
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-05-19
BackColor="#F7F7F7" />
</asp:GridView>
</div>
</form>
</body>
</html>
ClientInfo.cs using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; /// <summary> /// ClientInfo 的摘要说明 /// </summary> public class ClientInfo { private int clientID;//客户编号 public int ClientID { get { return clientID; } set { clientID = value; } } private string clientName;//客户姓名 public string ClientName { get { return clientName; } set { clientName = value; } } private string addressStr;//客户地址 public string AddressStr { get { return addressStr; } set { addressStr = value; } } private string postCode;//客户邮编 public string PostCode { get { return postCode; } set { postCode = value; } } private string telephone;//客户电话 public string Telephone { get { return telephone; } set { telephone = value; } } private string email;//客户邮件 public string Email { get { return email; } set { email = value; } } } ClientInfoAccessObj.cs using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections.Generic; using System.Data.SqlClient; /// <summary> /// ClientInfoAccessObj 議姜勣傍苧 /// </summary> public class ClientInfoAccessObj { //銭俊忖憲堪 private readonly string connString = "server=.\\sqlexpress;database=Clients;uid=sa;pwd=123456;"; //資誼侭嗤議人薩佚連 public List<ClientInfo> GetAllClients() { List<ClientInfo> clients = new List<ClientInfo>(); using (SqlConnection conn=new SqlConnection(connString)) { string sql = "select * from orderClient"; using (SqlCommand comm=new SqlCommand(sql,conn)) { conn.Open(); using (SqlDataReader sdr=comm.ExecuteReader()) { while (sdr.Read()) { ClientInfo ci = new ClientInfo(); ci.ClientID = int.Parse(sdr["ClientID"].ToString()); ci.ClientName = sdr["ClientName"].ToString(); ci.AddressStr = sdr["AddressStr"].ToString(); ci.PostCode = sdr["PostCode"].ToString(); ci.Telephone = sdr["Telephone"].ToString(); ci.Email = sdr["Email"].ToString(); |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于ASP.NET GridView学习之五 单行编辑的所有评论