数据库(数据库名为test)中表的内容:
数据库(数据库名为test)中表的内容:
.Net Code:
using (testEntities MyEntity = new testEntities())
{
#region linq to entities 内容练习3
var result = from s in MyEntity.stuinfo
where s.username == "pkm"
select new
{
username=s.username,
age=s.age
};
var psql = result.GetType().GetMethod("ToTraceString").Invoke(result, null);//得到原始sql语句
Console.WriteLine(psql);
#endregion
}.Net Code
using (testEntities TestEntity = new testEntities())
{
#region linq to entities 内容练习2
#region 父子关系表查询
/*
var maxScorePerClass = from s in TestEntity.stuinfo
group s by s.classID into s1
select new
{
classid = s1.Key,
stuinfo = from s2 in s1
where s2.score == s1.Max(p => p.score)
select s2
};数据准备:
if exists (select * from sysobjects where id = OBJECT_ID('[classinfo]') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE [classinfo]
CREATE TABLE [classinfo] (
[id] [bigint] NOT NULL,
[classID] [bigint] NOT NULL,
[className] [nvarchar] (50) NOT NULL,
[stat] [varchar] (2) NOT NULL DEFAULT (1),
[autoid] [bigint] IDENTITY (1, 1) NOT NULL)
ALTER TABLE [classinfo] WITH NOCHECK ADD CONSTRAINT [PK_classinfo] PRIMARY KEY NONCLUSTERED ( [id] )
SET IDENTITY_INSERT [classinfo] ON
INSERT [classinfo] ([id],[classID],[className],[stat],[autoid]) VALUES ( 1,1,N'计算机一班',N'1',1)
INSERT [classinfo] ([id],[classID],[className],[stat],[autoid]) VALUES ( 2,2,N'计算机二班',N'1',2)数据库表和数据准备:
textBoxCmdName.AllowDrop = true; textBoxCmdName.DragDrop += new DragEventHandler(txt_ObjDragDrop); textBoxCmdName.DragEnter += new DragEventHandler(txt_ObjDragEnter);
将win7电脑变身WiFi热点,让手机、笔记本共享上网
前提:电脑有无线网卡,WiFi无线站通过无线网卡工作
开启windows 7的隐藏功能:虚拟WiFi和SoftAP(即虚拟无线AP),就可以让电脑变成无线路由器,实现共享上网,节省网费和路由器购买费。宏碁、惠普笔记本和诺基亚N97mini亲测通过。
以操作系统为win7的笔记本或装有无线网卡的台式机作为主机。
Java高级-IDE介绍、Eclipse使用、Eclipse调试程序
Java高级-Java泛型简介
泛型简介
泛型是JDK1.5引入的新特性,也是最重要的一个特性。
泛型可以在编译的时候检查类型安全,并且所有的强制转换都自动和隐式的。
泛型的原理就是“类型的参数化”,即把类型看做参数。也就是说要把所要操作的数据类型看做参数,就像方法的形式参数是运行时传递的值的占位符一样。
Powered By Z-BlogPHP 1.7.3
Copyright 2024-2027 pukuimin Rights Reserved.
粤ICP备17100155号