上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: 二、现在,创建一个ASP.NET页面,然后在页面上加入一个GridView控件,使用下面的代码进行绑定数据: 1 using System.Data.Linq; 2 public partial class _Default : System.Web.UI.Page 3 { 4 protected void Page_Load(object sender, EventArgs e) 5 { 6 DataContext cxt = new DataContext("server = .;database = 'NorthWind' ;Integrated Secu... 阅读全文
posted @ 2013-07-13 16:52 Big.Eagle 阅读(3128) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 5 #define STACK_INIT_SIZE 20 6 #define STACKINCREMENT 10 7 8 typedef char ElemType; 9 typedef struct 10 {11 ElemType *base;12 ElemType *top;13 int stackSize;14 }sqStack;15 16 void InitStack(sqStack *s)17 {18 s->base = (ElemType*)malloc(STACK_I... 阅读全文
posted @ 2013-07-08 23:05 Big.Eagle 阅读(291) 评论(0) 推荐(0) 编辑
摘要: #include#include#define CardNum 13typedef struct Node{ int data; struct Node *next;}Node;void CreateList(Node **list ,int n = CardNum){ Node *head = (Node*)malloc(sizeof(Node)); head->next = NULL; Node* p =head; Node* s ; while( n--) { s = (Node*)malloc(sizeof(Node)); ... 阅读全文
posted @ 2013-07-06 19:32 Big.Eagle 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 4 #define Error 0 5 #define OK 1 6 typedef int ElemType; 7 typedef int status; 8 9 typedef struct Node10 {11 ElemType data;12 struct Node *next;13 }Node;14 15 //创建约瑟夫环16 17 status Create(Node** node ,int n)18 {19 Node* head = (Node*)malloc(sizeof(Node));20 ... 阅读全文
posted @ 2013-07-06 18:36 Big.Eagle 阅读(186) 评论(0) 推荐(0) 编辑
摘要: DataList:一般只用于展示数据,他只能通过设置模板来实现数据绑定。DataList不支持排序和分页功能,实现分页和排序方法见后面案例。DetailsView:一般用于展示一条数据,同时也可以实现更新和插入操作。经常用于主细表当中。各数据源控件之间的比较: •效率:GridView<DataList<Reapter 使用: •GridView一般用于以网格(表的)形式显示数据。 •DataList用于以Html自定义(模板)来显示数据 •Reapter数据绑定后不产生任何模板中没有的代码,所以常用于div+Css的网页布局或绑定生成xml文件FormView和Details.. 阅读全文
posted @ 2013-06-15 17:01 Big.Eagle 阅读(292) 评论(0) 推荐(0) 编辑
摘要: l由于每次正常连接数据库都会至少执行3个操作(1.登录数据库服务器2.执行操作3.注销用户),所以每次通过Connection向数据库服务器申请一个连接都比较耗时。【ado.net默认启用了连接池】l演示:有池没池的差别(见备注1.)通过事件查看器查看效果。l为了解决上述问题:ADO.Net采用了连接池的概念。l*如何清空连接池?Connection的静态方法ClearAllPools()、 ClearPool()l什么情况下需要禁用连接池?•一般都不禁用。尤其是asp.net之类的程序,n多个用户频繁访问,但是大多数用户访问时采用的都是同一个连接字符串•但如果某个应用程序有多个客户端,每个客 阅读全文
posted @ 2013-06-15 13:31 Big.Eagle 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 1、启用了连接池:默认情况下ADO.Net启用了连接池《连接池占用本地资源,不是数据库服务器资源,只是当连接池有对象是,数据库服务器要一直打开与相应对象的连接【比如本地连接池中有四个连接对象,那么数据库要打开四个连接保持与本地连接对象的连接】》。连接池的缺点就是始终保持与数据库的连接,本地连接池可以设置大小,用于限制连接池中可以存放连接对象的数量。 1 static void Main(string[] args) 2 { 3 //1.启用连接池与禁用连接池为什么性能差距这么大? 4 //1.当启用连接池后,看似是2000次的登录... 阅读全文
posted @ 2013-06-15 12:16 Big.Eagle 阅读(254) 评论(0) 推荐(1) 编辑
摘要: lSqlCommand的ExecuteScalar方法用于执行查询,并返回查询所返回的结果集中第一行的第一列,因为不能确定返回值的类型,所以返回值是object类型。//ExecuteScalar()方法内部也是调用ExecuteReader()实现的。•cmd.CommandText = "select count(*) from student";int i = Convert.ToInt32(cmd.ExecuteScalar())•cmd.CommandText = "select getdate()"; DateTime dt = Conver 阅读全文
posted @ 2013-06-15 11:56 Big.Eagle 阅读(2208) 评论(0) 推荐(0) 编辑
摘要: 1、执行有多行结果集的用ExecuteReader().2、HasRow属性返回是否有行3、 SqlDataReader reader = cmd.ExecuteReader();... while (reader.Read()) { Console.WriteLine(reader.GetString(1)); } reader的GetValue方法返回object类型的数据,如果想获取强类型的数据,可以使用reader的GetString、GetInt32等方法。4、reader的GetString、GetInt32等方法只接受整数参数,也就是序号,用GetOrdinal... 阅读全文
posted @ 2013-06-15 11:46 Big.Eagle 阅读(639) 评论(0) 推荐(0) 编辑
摘要: 表现层:由需求网页构成,调用业务逻辑层的方法。该层一般不出现SQL语句相关的内容,就算出现,也不能出现能执行的SQL语句。using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using HotelManager.Models;using HotelManager.BLL;namespace HotelManager{ public partial class RoomTypeA... 阅读全文
posted @ 2013-06-13 17:56 Big.Eagle 阅读(175) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页