string sql = @"INSERT INTO stu VALUES (@id,@name) "; 参数化查询是经常用到的,它可以有效防止SQL注入.但是需要手动去匹配参数@id,@name.数据量大时很繁琐,下面是自动填充SqlParameter列表的实现. 支持泛型,Object和ExpandoObject动态类型 using System; using System.Collections.Generic; using System.Data.SqlClient; usin…
var test1 = db.jj_RolesItem.Join(db.jj_SysItemsClass, m => m.ClassID, g => g.ClassID, (m, g) => new {m.RolesID,g.ClassName }).ToList(); var test2 = db.jj_RolesItem.Include(m => m.jj_SysItemsClass).Select(m => new {m.RolesID,m.jj_SysItemsCla…
--newid()可以在查询的时候自动生成Guid列 ' ordey by Random --创建对应的列 用 uniqueidentifier 类型 IF NOT EXISTS ( SELECT * FROM dbo.SysObjects WHERE ID = object_id(N'[RMA_ExchangeOrderAddTempInfo]') ) BEGIN SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE TABLE [dbo].[RM…