linq to sql 详
最近学习 linq to sql 感觉还是可以的,方便快捷,以前问是以为不好用,不想用,但是今天用了一下感觉还是不错的, 确实是快,但是我又在想
如果出错了怎么办,这样一个类里放那么多的文件是有点不好,再说了 linq to sql 低层不知道怎么实现的,还是没有自己写的访问感觉舒服点呵呵!!!
如果是快速开发用 linq to sql 还是不错的选择啊!!!
-
基本的增删除改查
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
namespace WebServiceText
{
/// <summary>
/// Service1 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
DataClasses1DataContext context = new DataClasses1DataContext();
[WebMethod]
public List<Text> selectSwhere(int startid,int endid)
{
var result = (from text in context.Text
where text.id >= startid && text .id <=endid
select text).ToList<Text>();
return result;
}
[WebMethod]
public List<Text> selectAll()
{
return context.Text.ToList<Text>();
}
/// <summary>
/// 添加一个数据
/// </summary>
/// <param name="sex">性别</param>
/// <param name="age">年龄</param>
/// <returns>成功为True否则为False</returns>
[WebMethod]
public List<Text> addText(string sex, int age)
{
Te
相关文档:
为了研究一下系统在后台都干了什么,当然是我在代码里没找到的情况下,研究了一下trace,结果有一定的帮助。oracle中不像sql server中那样直接提供图像化的工具,所以还是得自己动手来做,归纳了一下,步骤如下:
查询session:
SQL> select sid, serial#, username from v$session where username='XXX';//找出你要跟 ......
(1) 选择最有效率的表名顺序(只在基于规则的优化器中有效):
ORACLE的解析器按照从右到左的顺序处理from子句中的表名,from子句中写在最后的表(基础表 driving table)将被最先处理,在from子句中包含多个表的情况下,你必须选择记录条数最少的表作为基础表。如果有3个以上的表连接查询, 那 ......
有时候,在工作中会遇到将一个数据库中表的数据导到另一个数据库的表中,但是工具又没有提供这样的功能
下面能通过SQL语句生成Insert语句,再插入到另一个数据库中。
MSSQL:
SELECT 'INSERT INTO StatInfo(UserName,CardId,Address,WageCount,Pension)'+
' VALUES('''+a.UserName+''','''+a.CardId+''','''+a.Ad ......
--监控索引是否使用 alter index &index_name monitoring usage; alter index &index_name nomonitoring usage; select * from v$object_usage where index_name = &index_name;
--求数据文件的I/O分布 select df.name,phyrds,phywrts,phyblkrd,phyblkwrt,singleblkrds,readtim,writetim from v$filestat fs,v ......
一个sql语句:一个表test有四个字段id,a,b,c,如果表中的记录有三个字段a,b,c都相等,则说明这条记录是相同的,求相同的记录的个数 。
select a,b,c,count(*) from (select c.a,c.b,c.c from test c) having count(*) >= 2 group by a,b,c
或者
select zdbh,tdzl,zdmj,count(*) from ecaadmin.zdsx group by zdbh ......