摘要: DataSet:数据集。一般包含多个DataTable,用的时候,dataset["表名"]得到DataTableDataTable:数据表。一:SqlDataAdapter da=new SqlDataAdapter(cmd);DataTable dt=new DataTable();da.Fill(dt);-----------------直接把数据结果放到datatable中,二:SqlDataAdapter da=new SqlDataAdapter(cmd);DataSet dt=new DataSet();da.Fill(dt);----------------数据结果放到data 阅读全文
posted @ 2011-01-11 09:48 快乐的langYa 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 1、为DataTable添加列(1)添加列DataTable tbl = ds.Tables.Add("User");DataColumn col =tbl.Columns.Add("UserID",typeof(int));col.AllowDBNull = false;col.MaxLength = 6;col.Unique = true;tbl.PrimaryKey = new DataColumn[]{tbl.Columns["UserID"]}; 当设置主键时,AllowDBNull自动设置为False;(2)添加自增列DataSet ds = new DataSet();DataT 阅读全文
posted @ 2011-01-11 09:47 快乐的langYa 阅读(2381) 评论(0) 推荐(0) 编辑
摘要: 使用方法1、创建DataSet对象DataSet ds = new DataSet();DataSet ds = new DataSet("DataSetName");2、用数据集填充DataSet最常用的是DataAdapter对象的Fill()方法给他填充数据(1)DataSet ds = new DataSet();SqlDataAdapter adapt = new SqlDataAdapter(sqlcmd,con)adapt.Fill(ds,"mytest");(2)DataSet ds=new DataSet();DataTable dt=new DataTable("newTa 阅读全文
posted @ 2011-01-11 09:46 快乐的langYa 阅读(15047) 评论(2) 推荐(0) 编辑
摘要: DataSet是表和列结构在内存中的表示方式,DataSet支持多表、表间关系、数据约束等,和关系数据库的模型基本一致。(本质上是微型的数据库。包含一组DataTable对象和DataTable之间的连接关系。不包含数据库连接的概念,也就是说其中的数据可以不是来自数据库,可以是读取的文件中的数据。DataTable包含一些DataRow和DataColumn表示数据库表中的行和列,通过他们可以获取表、行和列的元素,且支持主键和外键。 DataSet的数据集是与数据库断开的,DataSet中可包括多个DataTable(可将多个查询结构存到一个DataSet中)。而DataTable中又包括多个 阅读全文
posted @ 2011-01-11 09:46 快乐的langYa 阅读(7429) 评论(0) 推荐(0) 编辑
摘要: 创建DataTable步骤:创建DataTable---创建列---将该列加入到DataTable中---根据表创建行,给行中每一列赋值,代码如下:DataSet ds=new DataSet("TestTbs"); //创建DataSetDataTable dt=new DataTable("Table1"); //创建表ds.Tables.Add(dt);//将表添加到DataSet中DataColumn ClassId=new DataColumn("ClassId",typeof(System.String)); //创建列DataColumn ClassName=new Dat 阅读全文
posted @ 2011-01-11 09:44 快乐的langYa 阅读(980) 评论(0) 推荐(0) 编辑
摘要: Dataset 并不是Recordset的简单翻版。从一定的意义上来说,DataView更类似于Recordset。如果说DataReader是访问数据的最容易的方式,那么Dataset则是最完整的数据访问对象。通过Dataset,你可以操作已有的数据,还可以通过程序创建Dataset,加入Table到Dataset,并建立这些Table之间的关系。使用Dataset的几个步骤第1步,创建到数据源的连接:SQLConnection con =new SQLConnection("server=localhost;uid=sa;pwd=;database=pubs");第2步,创建DataSet 阅读全文
posted @ 2011-01-11 09:42 快乐的langYa 阅读(663) 评论(0) 推荐(0) 编辑
摘要: 最近写了个嵌套的例子,做为参考^.^-----这是后置代码-----CS代码:ASPX:%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"htmlxmlns="http://www.w3.org/1999/xhtml"headrunat= 阅读全文
posted @ 2011-01-10 17:57 快乐的langYa 阅读(3355) 评论(3) 推荐(1) 编辑
摘要: 页面代码:后台程序: 阅读全文
posted @ 2011-01-10 17:51 快乐的langYa 阅读(314) 评论(0) 推荐(0) 编辑
摘要: Repeater嵌套前台页面部分:后台代码部分(部分代码): 阅读全文
posted @ 2011-01-10 17:46 快乐的langYa 阅读(335) 评论(0) 推荐(0) 编辑
摘要: aspx中:在外面的Repeater的ItemDataBound事件里写如下程序: 阅读全文
posted @ 2011-01-10 17:38 快乐的langYa 阅读(250) 评论(0) 推荐(0) 编辑
摘要: Repeater嵌套Repeater的结构:一般写过的都能看懂吧cs代码:aspx: 阅读全文
posted @ 2011-01-10 17:34 快乐的langYa 阅读(455) 评论(0) 推荐(0) 编辑
摘要: //绑定字段 //实现自动编号 通常使用的方法 其他用法 //如果属性为字符串类型就不用ToString()了 DataBinder.Eval用法范例 格式化字符串参数是可选的。如果忽略参数,DataBinder.Eval 返回对象类型的值, //显示二位小数 //{0:G}代表显示True或False ' ImageUrl='' /... 阅读全文
posted @ 2010-12-31 13:36 快乐的langYa 阅读(297) 评论(0) 推荐(0) 编辑
摘要: aspxaspx.cs 阅读全文
posted @ 2010-12-31 13:35 快乐的langYa 阅读(1161) 评论(0) 推荐(0) 编辑
摘要: 网络文件夹 选择功能 上传限制 上传文件 管理文件 允许上传文件的类型: ... 阅读全文
posted @ 2010-12-31 13:34 快乐的langYa 阅读(861) 评论(1) 推荐(0) 编辑
摘要: //1 使用REPEATER控件显示数据(指定字段显示) RepeaterBind.DataSource = ds.Tables["testTable"]; RepeaterBind.DataBind(); ----------------------------------... 阅读全文
posted @ 2010-12-31 13:32 快乐的langYa 阅读(801) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Collections; namespace HuLangCms { /... 阅读全文
posted @ 2010-12-30 17:05 快乐的langYa 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 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.WebPar... 阅读全文
posted @ 2010-12-30 17:04 快乐的langYa 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 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.WebPar... 阅读全文
posted @ 2010-12-30 17:03 快乐的langYa 阅读(205) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace HuLangCms { /**//// 用C#实现汉字转化为拼音 /// 实现的原理就是先将汉字转化成为内码,然后通过内码和拼音的对照来查找。 ... 阅读全文
posted @ 2010-12-30 17:03 快乐的langYa 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 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.WebPar... 阅读全文
posted @ 2010-12-30 17:02 快乐的langYa 阅读(266) 评论(0) 推荐(0) 编辑