linq to sql
来源:互联网 发布:mac画平面图的软件 编辑:程序博客网 时间:2024/05/02 01:18
//根据输入名称获得Id
DataClassesDataContext dc = new DataClassesDataContext();
string instrumentId = this.txtInstrument.Text.Trim().ToString();
//判断是否已存在
var query = from d in dc.Instruments where d.InstrumentId.Equals(instrumentId) select new { isHave = true };
if (query.Count() > 0)
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('该合约已存在!');</script>");
}
else
{
//新增一条记录
Instrument instrument = new Instrument();
instrument.InstrumentId = this.txtInstrument.Text.Trim().ToString();
instrument.InstrumentName = this.txtInstrument.Text.Trim().ToString();
instrument.FirstDate = DateTime.Now;
instrument.LastDate = DateTime.Now;
instrument.ProductId = 1;
dc.Instruments.InsertOnSubmit(instrument);
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功!');window.location='InstrumentInfo.aspx';</script>");
}
DataClassesDataContext dc = new DataClassesDataContext();
string instrumentId = this.txtInstrument.Text.Trim().ToString();
//判断是否已存在
var query = from d in dc.Instruments where d.InstrumentId.Equals(instrumentId) select new { isHave = true };
if (query.Count() > 0)
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('该合约已存在!');</script>");
}
else
{
//新增一条记录
Instrument instrument = new Instrument();
instrument.InstrumentId = this.txtInstrument.Text.Trim().ToString();
instrument.InstrumentName = this.txtInstrument.Text.Trim().ToString();
instrument.FirstDate = DateTime.Now;
instrument.LastDate = DateTime.Now;
instrument.ProductId = 1;
dc.Instruments.InsertOnSubmit(instrument);
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功!');window.location='InstrumentInfo.aspx';</script>");
}
//取最大值
int maxOrderGroupId = dc.Orders.Select(c => c.OrderGroupId).Max();
int maxOrderGroupId = dc.Orders.Max( a => a.OrderGroupId )
//分类统计和
var queryNotLock = from b in dc.Orders
group b by b.OrderGroupId into g
select g;
var q =
from p in dc.Orders
group p by p.OrderGroupId into g
select new
{
g.Key,
TotalVoluem = g.Sum(p => p.VolumeTotalOriginal)
};
- linq,linq to sql
- Linq初探--Linq to SQL
- LINQ to SQL 学习
- 什么是Linq to sql
- 使用LINQ to SQL
- 深入LINQ to SQL
- Linq To Sql注意事项
- Linq to SQL:基础知识
- LINQ to SQL实例
- 使用LINQ to SQL
- LINQ to SQL语句
- Linq to sql(一)
- LINQ to SQL语句
- LINQ TO SQL--insert
- LINQ TO SQL--delete
- LINQ TO SQL--update
- LINQ TO SQL--select
- Linq to SQL 资源
- 解决大量更新引起同步链延时问题
- 那些被遗漏的Objective-C保留字
- c# 获取access所有表名 获取指定表所有字段名
- spring学习笔记
- Qt读取中文文件
- linq to sql
- 17. Java I/O系统
- 用css和jquery实现标签页效果(一)
- SQL CURSOR 游标
- 让程序只运行一个实例的方法
- java利用poi生成excel报表
- Literal number(Java中的字面常量数字)
- traceroute原理
- 可输入下拉框